Whammy

Algorithm development and general DSP issues

Moderator: frank

Post Reply
deepMago!
Posts: 14
Joined: Sun Jul 03, 2011 4:34 pm
Location: Italia

Whammy

Post by deepMago! » Sun Jul 03, 2011 5:30 pm

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

Hides-His-Eyes
Posts: 5
Joined: Thu Jun 16, 2011 1:54 pm
Location: UK

Post by Hides-His-Eyes » Mon Jul 04, 2011 10:28 am

How is the response time, what with the pot time constant being so long?

deepMago!
Posts: 14
Joined: Sun Jul 03, 2011 4:34 pm
Location: Italia

Post by deepMago! » Mon Jul 04, 2011 10:52 am

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.

slacker
Posts: 116
Joined: Tue Feb 01, 2011 12:13 pm

Post by slacker » Tue Jul 05, 2011 10:41 am

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.

deepMago!
Posts: 14
Joined: Sun Jul 03, 2011 4:34 pm
Location: Italia

Post by deepMago! » Tue Jul 05, 2011 11:17 am

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.

deepMago!
Posts: 14
Joined: Sun Jul 03, 2011 4:34 pm
Location: Italia

Post by deepMago! » Tue Jul 05, 2011 11:22 am

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.

deepMago!
Posts: 14
Joined: Sun Jul 03, 2011 4:34 pm
Location: Italia

Post by deepMago! » Sat Jul 09, 2011 12:55 pm

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

frank
Posts: 991
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank » Sun Jul 10, 2011 11:59 am

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
Frank Thomson
Experimental Noize

deepMago!
Posts: 14
Joined: Sun Jul 03, 2011 4:34 pm
Location: Italia

Post by deepMago! » Sun Jul 10, 2011 1:02 pm

Thanks Frank,
it works now!
I've to study better the instruction set.

slacker
Posts: 116
Joined: Tue Feb 01, 2011 12:13 pm

Post by slacker » Sat Jul 16, 2011 7:23 am

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.

frank
Posts: 991
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank » Sat Jul 16, 2011 8:41 am

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
Frank Thomson
Experimental Noize

deepMago!
Posts: 14
Joined: Sun Jul 03, 2011 4:34 pm
Location: Italia

Post by deepMago! » Mon Jul 18, 2011 9:00 am

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!

jovesdies
Posts: 32
Joined: Wed Feb 25, 2009 2:55 am

Post by jovesdies » Wed Feb 12, 2014 11:42 pm

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

frank
Posts: 991
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank » Thu Feb 13, 2014 8:47 am

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.
Frank Thomson
Experimental Noize

smear
Posts: 14
Joined: Fri Jul 01, 2016 9:47 am

Post by smear » Tue Apr 25, 2017 10:11 pm

Just tried out the second version of this code (with corrections) and it works really well! Great stuff.

Post Reply