Page 1 of 1

Whammy

Posted: Sun Jul 03, 2011 5:30 pm
by deepMago!
Hello Everybody,
I'm new on this forum and I would share with you this simple program based on An-0001-4.spn code i'm working on.
My intention is reproduce a clone of whammy, using Pot0 in a pedal and Pot1 with a rotary switch to select some discrete pitch options like whammy do (second, third, fifth, octave up, octave down, dive bomb).
Using the Fv-1 with an analog mix between dry and Fx signals would be possible obtain the harmony mode. I don't want use digital mix cause I wanna use the right channel to perform shimmer using the fantastic program written by ronaldb.
Now the code is not complete, Pot0 works fine but Pot1 now is not discrete. I need to implement the Pot skip routine ( http://www.spinsemi.com/knowledge_base/ ... p_routines ).
But now for me is time to sleep, it's 2 A.M. in Italy.
And this is the code:


; Based on Application note AN-0001 program AN0001-4.spn

;POT0: Whammy Pedal
;Pot1: set the pitch range

; Memory declarations

delayl mem 4096 ; Left delay
temp mem 1 ; Temp location for partial calculations

pitch equ REG0


skp run,START
wldr RMP0,0,4096 ;could be 2048 for faster tracking?

START:

ldax ADCL ; Write it to left delay and clear ACC
wra delayl,0 ; Read in the current sample, ADCR -> ACC

; (1-k)*sample[addr]
cho rda,RMP0,REG|COMPC,delayl
; k*sample[addr+1] + ACC
cho rda,RMP0,,delayl+1
; ACC -> memory, ACC*0 -> ACC
wra temp,0
; (1-k)*sample[addr+ half ramp]
cho rda,RMP0,RPTR2|COMPC,delayl
; k*sample[addr+ half ramp + 1] + ACC
cho rda,RMP0,RPTR2,delayl+1
; ACC*(1-XFADE) + 0
cho sof,RMP0,NA|COMPC,0
; memory[addr] * XFADE + ACC
cho rda,RMP0,NA,temp
; Final result is in ACC, write it to DACL and clear ACC
wrax DACL,0

; Rate adjustment

ldax POT1
wrax pitch,0
ldax POT0 ; Read POT0 into ACC
mulx pitch ; Move from no pitch shift (0) to value set by "pitch" value

wrax RMP0_RATE,0 ; Load ACC into ramp rate register and clear ACC

Posted: Mon Jul 04, 2011 10:28 am
by Hides-His-Eyes
How is the response time, what with the pot time constant being so long?

Posted: Mon Jul 04, 2011 10:52 am
by deepMago!
I've tried only witch signal generator for now, but the response time seems to me fast. I've noticed in higher pitch some chorus that could be annoying.
Today I've bought for 15euro a besbeco pedal to try control the pitch by foot.

Posted: Tue Jul 05, 2011 10:41 am
by slacker
Nice, thanks for sharing it. I tried it and it works fine, the response feels fast there's possibly a little bit of lag if you very quickly give pot0 a full turn but nothing to worry about.

Once you have made pot1 select the intervals it will be a very nice effect.

Posted: Tue Jul 05, 2011 11:17 am
by deepMago!
Good to see that you have checked it.
For the Pot1 I think is necessary implementation on the code.
For me this is not a complete program but a starting point.
I would try connect a pedale and yes I would implement the selection for intervals.

Posted: Tue Jul 05, 2011 11:22 am
by deepMago!
Ah, just another thing that I would check, The first line in program, when initialize the ramp LFO, is possible use instead 4096 a smaller number dividing by 2. Like 2048 or 1024. In this way if I understand is possible reduce the lag but I think more chorus effect. You can read in this way: more faster the ramp more fast the tracking.
My english is not so good hope it's clear.

Posted: Sat Jul 09, 2011 12:55 pm
by deepMago!
Hi everybody.
Tried the program with a pedal instead POT0. Lower the ramp resolution to 2048 and for me is fine. Good latency even if i play fast notes.
Now I tried to implement the selection by POT1 of only four options using skip routines. The idea is after this works to pass at eight options or 16.
But the code doesn't work. I'll tried all the afternoon but I can't figure were is the trouble.
There's someone that could check this code and help me?

; Based on Application note AN-0001 program AN0001-4.spn

;POT0: Whammy Pedal
;Pot1: set the pitch range - only 4 selection allowed (DIVEBOMB, OCT DOWN, FIFTH, OCT uP)

; Memory declarations

delayl mem 2048 ; delay
temp mem 1 ; Temp location for partial calculations
pitch equ REG0
DVBMB equ -0.47 ; four octaves down
OCDWN equ -0.25 ; one octave down
FFTH equ 0.25 ; one fifth up
OCTUP equ 0.5 ; one octave up

skp run,START
wldr RMP0,0,2048 ;faster tracking

START:

ldax ADCL ; Write it to left delay and clear ACC
wra delayl,0 ; Read in the current sample, ADCR -> ACC

; (1-k)*sample[addr]
cho rda,RMP0,REG|COMPC,delayl
; k*sample[addr+1] + ACC
cho rda,RMP0,,delayl+1
; ACC -> memory, ACC*0 -> ACC
wra temp,0
; (1-k)*sample[addr+ half ramp]
cho rda,RMP0,RPTR2|COMPC,delayl
; k*sample[addr+ half ramp + 1] + ACC
cho rda,RMP0,RPTR2,delayl+1
; ACC*(1-XFADE) + 0
cho sof,RMP0,NA|COMPC,0
; memory[addr] * XFADE + ACC
cho rda,RMP0,NA,temp
; Final result is in ACC, write it to DACL and clear ACC
wrax DACL,0

;Program Select:

rdax POT1,1
and %01100000_00000000_00000000 ;mask off only 2 bits, leaving only 4 possibilities
skp zro,DIVEBOMB ;if zero, skip over
sof 1,-0.25 ;subtract 1/4
skp zro,OCTDOWN ;if zero, skip over
sof 1,-0.25 ;subtract 1/4
skp zro,FIFTH ;if zero, skip over
clr ;clear the accumulator, there's 1/4 left in it!
skp zro,OCTAVEUP ;skip over

DIVEBOMB:

ldax DVBMB
skp neg,WHAMMY

OCTDOWN:

ldax OCDWN
skp neg,WHAMMY

FIFTH:

ldax FFTH
skp gez,WHAMMY

OCTAVEUP:

ldax OCTUP

WHAMMY:

wrax pitch,0
ldax POT0 ; Read POT0 into ACC
mulx pitch ; Move from no pitch shift (0) to value set by "pitch" value

wrax RMP0_RATE,0 ; Load ACC into ramp rate register and clear ACC

Posted: Sun Jul 10, 2011 11:59 am
by frank
I believe the problem is with the lines like:

ldax DVBMB

ldax wants to load from a register but you defined DVBMB as a constant at the top of the code so you probably want something like:

sof 0,DVBMB

to load the acc with the value of DVBMB

Posted: Sun Jul 10, 2011 1:02 pm
by deepMago!
Thanks Frank,
it works now!
I've to study better the instruction set.

Posted: Sat Jul 16, 2011 7:23 am
by slacker
I just tried this, with Frank's code changes and it works very well, I'll have to think about adding an expression pedal to my FV1 build. Thanks again for sharing it.

Posted: Sat Jul 16, 2011 8:41 am
by frank
A while ago donstavely posted a little code block that can help speed up the POT response for use with expression pedals at http://www.spinsemi.com/forum/viewtopic.php?t=72

Posted: Mon Jul 18, 2011 9:00 am
by deepMago!
Hi Frank,
this link is very interesting, cause after played a little I've noticed that the pedal seems slowly than me. I've thinked about reduce more the timing of the ramp but if this solution works I thinks could be better. I have to give it a try!

Posted: Thu Feb 13, 2014 12:42 am
by jovesdies
Hi,
I've tried with 1024 delay memory and it works very well.
A cool feature would be to bypass the whammy when pot0 is in zero position.
Is a code like this ok ?

skp zro, BYPS

....


BYPS

rdax adcl, 1
wrax dacl, 0

Posted: Thu Feb 13, 2014 9:47 am
by frank
You could do that but you want to make sure it doesn't interfere with other code. For instance if this is at the end of all the code it would overwrite anything that was already written to the DAC. So you will want to jump over that end piece if the whammy is engaged.

Posted: Tue Apr 25, 2017 10:11 pm
by smear
Just tried out the second version of this code (with corrections) and it works really well! Great stuff.