is it possible to "REG" a single sin/ramp multiple times in the FV-1

Started by Boner, December 05, 2022, 08:37:20 PM

Previous topic - Next topic

Boner

I'm trying to use a single ramp/lfo to do 2 different pitch shifts. However its not working....

The code uses ramp0 to shift an input by POT0 up or down, it then puts that into REG2

Then it "re REG's" ramp0 to shift the input value again up or down, but this time with ramp0 frequency half of the POT0 value.

This value is then added to REG2 and outputted. The goal is to have an up or down pitch shift but with an additional half-shift mixed in.

What happens when I try to introduce the second shifting, the entire effect is killed and its just audio in is output to audio out, if I take out the code with the second shifting it works as normal, IE pot0 shifts the input up and down

I know I could use ramp1 to accomplish this, but I'm REALLY hoping I can do so without. Thanks all.


My code:

; do next command only once
SKP RUN ,1

; Load RAMP generator with initial conditions
WLDR 0, 32767, 512


; read right channel input into ACC
LDAX ADCR

; Write ACC to delay memory location
  • and multiply ACC by 0.0
    WRA 0, 0.0

    ; Read register value, multiply by coefficient and add to ACC.
    RDAX POT0, 1.0

    ; Multiply ACC by the coefficient value and add a constant (Scale and OFfset)
    SOF 1.0, -0.5

    ; If ACC >= 0, skip the ACC*0.5 instruction
    SKP GEZ,1
    SOF 0.5, 0.0

    ; Write ACC to register, multiply ACC by coefficient
    WRAX RMP0_RATE, 0


    CHO RDA,2,REG | COMPC,0
    CHO RDA,2,0,1
    WRA 513,0.0
    CHO RDA,2,COMPC | RPTR2,0
    CHO RDA,2,RPTR2,1
    CHO SOF,2,COMPC | NA,0.0
    CHO RDA,2,NA,513

    ; Multiply ACC by the coefficient value and add a constant (Scale and OFfset)
    SOF 0.5, 0

    ;Write ACC to register, multiply ACC by coefficient
    WRAX REG2, 0


    ; Read register value, multiply by coefficient and add to ACC.
    RDAX RMP0_RATE, 0.5, 0              ; THIS NO WORK


    ; Write ACC to register, multiply ACC by coefficient   
    WRAX RMP0_RATE, 0.0                 ; THIS NO WORK


    ; new shift, does not work. Entire shifting stops and its just audio in = audio out
    CHO RDA, 2,  REG | COMPC,  0
    CHO RDA, 2,0, 1
    WRA 4097, 0.0
    CHO RDA, 2, COMPC | RPTR2, 0
    CHO RDA, 2, RPTR2,1
    CHO SOF, 2, COMPC | NA, 0.0
    CHO RDA, 2, NA,4097



    ; Multiply ACC by the coefficient value and add a constant (Scale and OFfset)
    SOF 0.5, 0

    ;; Read register value, multiply by coefficient and add to ACC.
    RDAX REG2, 1


    ; Write ACC to register, multiply ACC by coefficient
    WRAX DACR,0.0000000000




ElectricDruid

The problem is that it's not the *instantaneous* ramp LFO rate that sets the shift. You can't just tweak the rate and then get a different pitch shift. You need to think about *how* the shift is produced to work out whether what you're trying to do is possible. Have a read of Spin's notes about it again:

http://spinsemi.com/Products/appnotes/spn1001/AN-0001.pdf

It is possible to generate a ramp wave at half the frequency of another by scaling it, and offsetting every other wavecycle. Perhaps something like that would be possible to give you the index you need for your half-shift?

HTH,
Tom

octfrank

Ramp/LFO are only updated once per sample period so you cannot just change the coefficient and get a new frequency in the same sample period. You would need to use 2 different ones or as Electric Druid says come up with a way to scale/shift the ramp to generate the shape you need for the second one.

Most likely you will need to use both ramps to do what you want as shifting is a complex mix of 2 pointers and cross fading.
Frank Thomson
Experimental Noize

Boner

Quote from: ElectricDruid on December 06, 2022, 02:07:02 AM

It is possible to generate a ramp wave at half the frequency of another by scaling it, and offsetting every other wavecycle. Perhaps something like that would be possible to give you the index you need for your half-shift?

HTH,
Tom

Oh thats a good idea!!! Looks like that is a way to do it.

Thank you both