My gf used ChatGPT to prove me I was bad at designing pedals...

Ai is nice for graphical stuff but for example whenever I'm lazy and use ChatGPT for something to code that damn tool is taking all things as a given. I want to check what it tells me for a Leslie effect for the Terrarium and it puts out a part of the library that does not even exist. I think AI will not take over the world in the near future.
 
Some of our coders in the company use ai supported tools but not just to generate code but to elp write the code.
Yup they can be good for generating stuff that isn't super complex but would be time consuming to write by hand. They can also help with formatting something that's going to be written and finalized by a human. AI generated code can be useful when it's being reviewed by someone that knows what they're doing, but I don't trust it to generate full working code the first time.
 
AI generated code can be useful when it's being reviewed by someone that knows what they're doing, but I don't trust it to generate full working code the first time.
Yep. I use AI to help write code at work. I know exactly what I want it to generate, it just saves time typing it out. Over time, you learn the situations where it will most likely do that. I read every line it spits out.
 
PLEASE post that complete code here! I'd like to try it.
Deleted the original code so had it ask again. Here you go!


Creating barnyard animal sounds for a guitar pedal using the FV-1 chip is an interesting challenge, as the chip's primary use is for audio processing rather than sampling complex sounds. However, it is possible to approximate basic animal sounds (such as a cow's moo or a pig's oink) by using simple synthesis techniques, including oscillators, waveforms, and modulation effects. In this case, we'll use the available features of the FV-1 to generate these sounds.


The FV-1 works by processing the audio in real-time using assembly language, allowing for various types of sound manipulation like pitch modulation, oscillation, and filtering. Below is a complete FV-1 code for creating two basic barnyard animal sounds: a cow's moo and a pig's oink. The goal is to make use of pitch control and simple oscillators to generate these sound effects.


Code for FV-1 Barnyard Animal Sounds​


; FV-1 Barnyard Animals Sound Generator (Cow's Moo and Pig's Oink)<br>; For guitar pedal use. Will generate two animal sounds based on pitch.<br><br>; Constants<br>cow_frequency equ 320 ; Cow's moo (low-frequency sound)<br>pig_frequency equ 450 ; Pig's oink (higher frequency)<br><br>; Envelope control (attack, decay, sustain, release times)<br>attack_time equ 10 ; Envelope attack time<br>decay_time equ 40 ; Envelope decay time<br>sustain_level equ 0x70 ; Envelope sustain level<br>release_time equ 30 ; Envelope release time<br><br>; Main program starts here<br>start:<br> ; First, let's initialize the sound generator for the cow's moo<br> ; Load cow frequency into both oscillators<br> freq_osc1 cow_frequency ; Set oscillator 1 frequency for cow sound<br> freq_osc2 cow_frequency ; Set oscillator 2 frequency for cow sound<br><br> ; Apply a basic wave (sawtooth wave) for the moo sound<br> wave_osc1 0x1 ; Set Oscillator 1 waveform to sawtooth<br> wave_osc2 0x1 ; Set Oscillator 2 waveform to sawtooth<br><br> ; Apply an envelope to shape the sound (attack, decay, sustain, release)<br> env_attack attack_time ; Apply attack time for smooth start<br> env_decay decay_time ; Apply decay time for tone shaping<br> env_sustain sustain_level ; Set sustain level for continuous tone<br> env_release release_time ; Apply release for smooth fade-out<br><br> ; Start the sound (loop until the sound is manually changed)<br> loop cow_sound<br><br>cow_sound:<br> ; Keep the sound playing until interrupted<br> jmp cow_sound<br><br> ; Now, let's switch to the pig's oink sound<br> ; Change the frequency for pig sound (higher pitch)<br> freq_osc1 pig_frequency ; Set oscillator 1 frequency for pig sound<br> freq_osc2 pig_frequency ; Set oscillator 2 frequency for pig sound<br><br> ; Apply a different waveform for the pig sound (square wave for a grunt-like effect)<br> wave_osc1 0x2 ; Set Oscillator 1 waveform to square wave<br> wave_osc2 0x2 ; Set Oscillator 2 waveform to square wave<br><br> ; Apply envelope for pig sound with same parameters<br> env_attack attack_time ; Apply attack time for pig sound<br> env_decay decay_time ; Apply decay time for pig sound<br> env_sustain sustain_level ; Set sustain level for pig sound<br> env_release release_time ; Apply release for pig sound<br><br> ; Start the pig sound loop<br> loop pig_sound<br><br>pig_sound:<br> ; Keep the pig sound active until interrupted<br> jmp pig_sound<br><br>end<br>

Explanation:​


  1. Frequency Settings:
    • Cow's Moo: The frequency for the cow sound (cow_frequency) is set to 320 Hz, which is a low-frequency tone to mimic the deep "moo" sound.
    • Pig's Oink: The frequency for the pig sound (pig_frequency) is set to 450 Hz, which is a higher-pitched tone appropriate for an "oink" sound.
  2. Oscillator Settings:
    • For the cow sound, the waveform is set to sawtooth (0x1), which gives a smooth, continuous tone that resembles the moo of a cow.
    • For the pig sound, the waveform is set to square wave (0x2), producing a more percussive, grunt-like sound that fits the oink sound.
  3. Envelope Settings:
    • The envelope is used to shape the sound. It has four main phases:
      • Attack: Determines how fast the sound reaches its peak.
      • Decay: How fast it drops to the sustain level.
      • Sustain: The constant level at which the sound will hold.
      • Release: How the sound fades out when stopped.
    • The envelope values (attack_time, decay_time, sustain_level, release_time) are set to reasonable values for both the cow and pig sounds to ensure smooth transitions and natural fades.
  4. Loops:
    • The loop commands are used to keep the sound playing. When the program starts, it plays the cow sound and keeps looping until the sound is changed.
    • After the cow sound is finished (or based on some external control), the code switches to the pig sound and enters a similar loop to keep the pig sound active.
  5. Switching Sounds:
    • In this example, the sounds don't switch automatically (i.e., they run in sequence), but you could implement external controls (e.g., a footswitch or MIDI input) to trigger the change from cow to pig sound dynamically.

How to Use:​


  1. Copy the code into your FV-1 development environment (such as SpinCAD, or any tool that supports FV-1 programming).
  2. Upload the code to the FV-1 chip (or use an FV-1 emulator for testing).
  3. Activate the pedal (if you're using a physical FV-1-based pedal) and test the sounds. You should hear either a cow’s moo or a pig’s oink depending on the current sound mode.

Fine-Tuning:​


You can further adjust the following parameters to refine the sounds:


  • Envelope times: If you want the moo to sustain longer or the oink to be snappier, adjust attack_time, decay_time, sustain_level, and release_time.
  • Frequency: Fine-tune the frequency values for cow (cow_frequency) and pig (pig_frequency) to get the exact pitch you want.

Advanced Features (Optional):​


  • Pitch modulation: Use pitch modulation (LFO or other techniques) to add vibrato or wobble to the sound for more realism.
  • Filter effects: Apply low-pass filters to smooth out the sounds further, especially for the pig's grunt, which could benefit from a bit more timbral control.

This code gives you a basic framework for generating barnyard animal sounds on the FV-1 chip, ideal for use in a fun guitar pedal!
 
I used it lately as well for generating 3D models in freeCAD, using the python console, just as I instructed it generated for example this pickup selector plate, I by the way have no knowledge whatsoever in 3D design:
Pickup plate

A friend printed it for me and all fits and look like I instructed

same for these:
Truss Rod Cover
Pickup Ring
 
I use AI code generation at work as well. It is useful but definitely needs human proofing and the tooling can get in the way sometimes. It feels a bit like a 7 year old watching what I’m doing and suggesting the next thing. If mechanical, they usually get it right, otherwise not so much…
 
Deleted the original code so had it ask again. Here you go!


Creating barnyard animal sounds for a guitar pedal using the FV-1 chip is an interesting challenge, as the chip's primary use is for audio processing rather than sampling complex sounds. However, it is possible to approximate basic animal sounds (such as a cow's moo or a pig's oink) by using simple synthesis techniques, including oscillators, waveforms, and modulation effects. In this case, we'll use the available features of the FV-1 to generate these sounds.


The FV-1 works by processing the audio in real-time using assembly language, allowing for various types of sound manipulation like pitch modulation, oscillation, and filtering. Below is a complete FV-1 code for creating two basic barnyard animal sounds: a cow's moo and a pig's oink. The goal is to make use of pitch control and simple oscillators to generate these sound effects.


Code for FV-1 Barnyard Animal Sounds​


; FV-1 Barnyard Animals Sound Generator (Cow's Moo and Pig's Oink)<br>; For guitar pedal use. Will generate two animal sounds based on pitch.<br><br>; Constants<br>cow_frequency equ 320 ; Cow's moo (low-frequency sound)<br>pig_frequency equ 450 ; Pig's oink (higher frequency)<br><br>; Envelope control (attack, decay, sustain, release times)<br>attack_time equ 10 ; Envelope attack time<br>decay_time equ 40 ; Envelope decay time<br>sustain_level equ 0x70 ; Envelope sustain level<br>release_time equ 30 ; Envelope release time<br><br>; Main program starts here<br>start:<br> ; First, let's initialize the sound generator for the cow's moo<br> ; Load cow frequency into both oscillators<br> freq_osc1 cow_frequency ; Set oscillator 1 frequency for cow sound<br> freq_osc2 cow_frequency ; Set oscillator 2 frequency for cow sound<br><br> ; Apply a basic wave (sawtooth wave) for the moo sound<br> wave_osc1 0x1 ; Set Oscillator 1 waveform to sawtooth<br> wave_osc2 0x1 ; Set Oscillator 2 waveform to sawtooth<br><br> ; Apply an envelope to shape the sound (attack, decay, sustain, release)<br> env_attack attack_time ; Apply attack time for smooth start<br> env_decay decay_time ; Apply decay time for tone shaping<br> env_sustain sustain_level ; Set sustain level for continuous tone<br> env_release release_time ; Apply release for smooth fade-out<br><br> ; Start the sound (loop until the sound is manually changed)<br> loop cow_sound<br><br>cow_sound:<br> ; Keep the sound playing until interrupted<br> jmp cow_sound<br><br> ; Now, let's switch to the pig's oink sound<br> ; Change the frequency for pig sound (higher pitch)<br> freq_osc1 pig_frequency ; Set oscillator 1 frequency for pig sound<br> freq_osc2 pig_frequency ; Set oscillator 2 frequency for pig sound<br><br> ; Apply a different waveform for the pig sound (square wave for a grunt-like effect)<br> wave_osc1 0x2 ; Set Oscillator 1 waveform to square wave<br> wave_osc2 0x2 ; Set Oscillator 2 waveform to square wave<br><br> ; Apply envelope for pig sound with same parameters<br> env_attack attack_time ; Apply attack time for pig sound<br> env_decay decay_time ; Apply decay time for pig sound<br> env_sustain sustain_level ; Set sustain level for pig sound<br> env_release release_time ; Apply release for pig sound<br><br> ; Start the pig sound loop<br> loop pig_sound<br><br>pig_sound:<br> ; Keep the pig sound active until interrupted<br> jmp pig_sound<br><br>end<br>

Explanation:​


  1. Frequency Settings:
    • Cow's Moo: The frequency for the cow sound (cow_frequency) is set to 320 Hz, which is a low-frequency tone to mimic the deep "moo" sound.
    • Pig's Oink: The frequency for the pig sound (pig_frequency) is set to 450 Hz, which is a higher-pitched tone appropriate for an "oink" sound.
  2. Oscillator Settings:
    • For the cow sound, the waveform is set to sawtooth (0x1), which gives a smooth, continuous tone that resembles the moo of a cow.
    • For the pig sound, the waveform is set to square wave (0x2), producing a more percussive, grunt-like sound that fits the oink sound.
  3. Envelope Settings:
    • The envelope is used to shape the sound. It has four main phases:
      • Attack: Determines how fast the sound reaches its peak.
      • Decay: How fast it drops to the sustain level.
      • Sustain: The constant level at which the sound will hold.
      • Release: How the sound fades out when stopped.
    • The envelope values (attack_time, decay_time, sustain_level, release_time) are set to reasonable values for both the cow and pig sounds to ensure smooth transitions and natural fades.
  4. Loops:
    • The loop commands are used to keep the sound playing. When the program starts, it plays the cow sound and keeps looping until the sound is changed.
    • After the cow sound is finished (or based on some external control), the code switches to the pig sound and enters a similar loop to keep the pig sound active.
  5. Switching Sounds:
    • In this example, the sounds don't switch automatically (i.e., they run in sequence), but you could implement external controls (e.g., a footswitch or MIDI input) to trigger the change from cow to pig sound dynamically.

How to Use:​


  1. Copy the code into your FV-1 development environment (such as SpinCAD, or any tool that supports FV-1 programming).
  2. Upload the code to the FV-1 chip (or use an FV-1 emulator for testing).
  3. Activate the pedal (if you're using a physical FV-1-based pedal) and test the sounds. You should hear either a cow’s moo or a pig’s oink depending on the current sound mode.

Fine-Tuning:​


You can further adjust the following parameters to refine the sounds:


  • Envelope times: If you want the moo to sustain longer or the oink to be snappier, adjust attack_time, decay_time, sustain_level, and release_time.
  • Frequency: Fine-tune the frequency values for cow (cow_frequency) and pig (pig_frequency) to get the exact pitch you want.

Advanced Features (Optional):​


  • Pitch modulation: Use pitch modulation (LFO or other techniques) to add vibrato or wobble to the sound for more realism.
  • Filter effects: Apply low-pass filters to smooth out the sounds further, especially for the pig's grunt, which could benefit from a bit more timbral control.

This code gives you a basic framework for generating barnyard animal sounds on the FV-1 chip, ideal for use in a fun guitar pedal!
I was hoping to acquire the ASM code. It looks like that first section IS the ASM code, but it needed to be wrapped on CodeQuotes before posting. A lot wa lost in the HTML translation. Thanks anyway man.
 
This has got me thinking even more.....

I am going to ask for a schematic for a Klon inspired overdrive and will breadboard it tonight, see how it does!
 
I asked Gemini to write a modulated delay FV1 program and it spit this out:

Code:
; Memory locations
.def DelayLineLength = $0200  ; Adjust for desired delay time
.def DelayLineStart = $1000
.def ModulatorPhase = $0300
.def ModulatorIncrement = $0301

; Main program
Start:
  ; Load input sample
  Load ACC, IN

  ; Read delay line sample
  Load X, [DelayLineStart + ModulatorPhase]

  ; Add input and delayed sample
  Add ACC, X

  ; Store current input sample in delay line
  Store [DelayLineStart + ModulatorPhase], ACC

  ; Increment modulator phase
  Load X, ModulatorIncrement
  Add ModulatorPhase, X

  ; Output the processed sample
  Store OUT, ACC

  ; Loop back to the start
  Br Start

Does anybody know if that makes any sense?

Edit: second attempt looks very different:

Code:
; Modulated Delay with Feedback and Mix Controls

; Delay time controlled by pot0 (0ms to 1000ms)
; Modulation depth controlled by pot1 (0 to 100%)
; Feedback controlled by pot2 (0% to 95%)
; Mix controlled by pot3 (0% to 100%)

; Initialize memory addresses for delay line
delay_line  equ     0
delay_end   equ     32767

; Initialize LFO parameters
lfo_freq    equ     2      ; LFO frequency in Hz
lfo_depth   equ     500    ; LFO depth in samples

; Calculate LFO increment based on frequency
lfo_inc     equ     lfo_freq * 65536 / 44100

; Initialize LFO phase accumulator
lfo_phase   equ     0

; Main program loop
start:
    ; Read input sample
    in  adcl     sinl
    
    ; Calculate delay time based on pot0
    rdax    pot0
    mulx    delay_end
    wrax    delay_ptr

    ; Calculate LFO value
    rdax    lfo_phase      ; Read LFO phase accumulator
    addx    lfo_inc        ; Increment LFO phase
    wrax    lfo_phase      ; Write back updated phase
    andx    $7FFF          ; Keep phase within 0-32767 range
    sin     lfo_phase      ; Generate sine wave from phase
    mulx    lfo_depth      ; Scale by LFO depth
    
    ; Add LFO value to delay pointer
    rdax    delay_ptr
    addx    acc
    wrax    delay_ptr

    ; Read delayed sample from memory
    rda     delay_ptr

    ; Apply feedback
    rdax    pot2            ; Read feedback pot
    mulx    $0.95           ; Scale feedback to 0-95%
    macc    -1,0            ; Invert feedback for negative feedback
    wrax    feedback        ; Store feedback value

    ; Mix dry and wet signals
    rdax    pot3            ; Read mix pot
    mulx    feedback        ; Apply feedback to delayed signal
    macc    pot3,-1         ; Subtract mix from 100% for dry signal
    mulx    in              ; Scale dry signal
    addx    acc             ; Add wet and dry signals

    ; Write input sample to delay line
    wra     delay_line,0

    ; Output mixed signal
    out     acc

    ; Loop back to start
    jmp     start
 
I asked Gemini to write a modulated delay FV1 program and it spit this out:

Code:
; Memory locations
.def DelayLineLength = $0200  ; Adjust for desired delay time
.def DelayLineStart = $1000
.def ModulatorPhase = $0300
.def ModulatorIncrement = $0301

; Main program
Start:
  ; Load input sample
  Load ACC, IN

  ; Read delay line sample
  Load X, [DelayLineStart + ModulatorPhase]

  ; Add input and delayed sample
  Add ACC, X

  ; Store current input sample in delay line
  Store [DelayLineStart + ModulatorPhase], ACC

  ; Increment modulator phase
  Load X, ModulatorIncrement
  Add ModulatorPhase, X

  ; Output the processed sample
  Store OUT, ACC

  ; Loop back to the start
  Br Start

Does anybody know if that makes any sense?

Edit: second attempt looks very different:

Code:
; Modulated Delay with Feedback and Mix Controls

; Delay time controlled by pot0 (0ms to 1000ms)
; Modulation depth controlled by pot1 (0 to 100%)
; Feedback controlled by pot2 (0% to 95%)
; Mix controlled by pot3 (0% to 100%)

; Initialize memory addresses for delay line
delay_line  equ     0
delay_end   equ     32767

; Initialize LFO parameters
lfo_freq    equ     2      ; LFO frequency in Hz
lfo_depth   equ     500    ; LFO depth in samples

; Calculate LFO increment based on frequency
lfo_inc     equ     lfo_freq * 65536 / 44100

; Initialize LFO phase accumulator
lfo_phase   equ     0

; Main program loop
start:
    ; Read input sample
    in  adcl     sinl
  
    ; Calculate delay time based on pot0
    rdax    pot0
    mulx    delay_end
    wrax    delay_ptr

    ; Calculate LFO value
    rdax    lfo_phase      ; Read LFO phase accumulator
    addx    lfo_inc        ; Increment LFO phase
    wrax    lfo_phase      ; Write back updated phase
    andx    $7FFF          ; Keep phase within 0-32767 range
    sin     lfo_phase      ; Generate sine wave from phase
    mulx    lfo_depth      ; Scale by LFO depth
  
    ; Add LFO value to delay pointer
    rdax    delay_ptr
    addx    acc
    wrax    delay_ptr

    ; Read delayed sample from memory
    rda     delay_ptr

    ; Apply feedback
    rdax    pot2            ; Read feedback pot
    mulx    $0.95           ; Scale feedback to 0-95%
    macc    -1,0            ; Invert feedback for negative feedback
    wrax    feedback        ; Store feedback value

    ; Mix dry and wet signals
    rdax    pot3            ; Read mix pot
    mulx    feedback        ; Apply feedback to delayed signal
    macc    pot3,-1         ; Subtract mix from 100% for dry signal
    mulx    in              ; Scale dry signal
    addx    acc             ; Add wet and dry signals

    ; Write input sample to delay line
    wra     delay_line,0

    ; Output mixed signal
    out     acc

    ; Loop back to start
    jmp     start
When I compare this code to working SpinASM files I have on hand, it appears the syntax in this code is not fully compatible.For example: in SpinASM code, the output references are thus:
Code:
RDAX REG14,1.0000000000
WRAX DACL,0.0000000000

Whereas in this code, the output appears to be:
Code:
; Output mixed signal
  out     acc

So it makes me wonder if AI has a ways to go before getting things just right for coding SpinASM at least.
 
Last edited:
Back
Top