Spin Semiconductor Forum Index Spin Semiconductor
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Whammy

 
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> Algorithm development
View previous topic :: View next topic  
Author Message
deepMago!



Joined: 03 Jul 2011
Posts: 14
Location: Italia

PostPosted: Sun Jul 03, 2011 4:30 pm    Post subject: Whammy Reply with quote

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/coding_examples.html#POT_skip_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
Back to top
View user's profile Send private message
Hides-His-Eyes



Joined: 16 Jun 2011
Posts: 5
Location: UK

PostPosted: Mon Jul 04, 2011 9:28 am    Post subject: Reply with quote

How is the response time, what with the pot time constant being so long?
Back to top
View user's profile Send private message
deepMago!



Joined: 03 Jul 2011
Posts: 14
Location: Italia

PostPosted: Mon Jul 04, 2011 9:52 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
slacker



Joined: 01 Feb 2011
Posts: 115

PostPosted: Tue Jul 05, 2011 9:41 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
deepMago!



Joined: 03 Jul 2011
Posts: 14
Location: Italia

PostPosted: Tue Jul 05, 2011 10:17 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
deepMago!



Joined: 03 Jul 2011
Posts: 14
Location: Italia

PostPosted: Tue Jul 05, 2011 10:22 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
deepMago!



Joined: 03 Jul 2011
Posts: 14
Location: Italia

PostPosted: Sat Jul 09, 2011 11:55 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
frank



Joined: 19 Oct 2005
Posts: 972

PostPosted: Sun Jul 10, 2011 10:59 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
deepMago!



Joined: 03 Jul 2011
Posts: 14
Location: Italia

PostPosted: Sun Jul 10, 2011 12:02 pm    Post subject: Reply with quote

Thanks Frank,
it works now!
I've to study better the instruction set.
Back to top
View user's profile Send private message
slacker



Joined: 01 Feb 2011
Posts: 115

PostPosted: Sat Jul 16, 2011 6:23 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
frank



Joined: 19 Oct 2005
Posts: 972

PostPosted: Sat Jul 16, 2011 7:41 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
deepMago!



Joined: 03 Jul 2011
Posts: 14
Location: Italia

PostPosted: Mon Jul 18, 2011 8:00 am    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
jovesdies



Joined: 25 Feb 2009
Posts: 32

PostPosted: Wed Feb 12, 2014 11:42 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
frank



Joined: 19 Oct 2005
Posts: 972

PostPosted: Thu Feb 13, 2014 8:47 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
smear



Joined: 01 Jul 2016
Posts: 13

PostPosted: Tue Apr 25, 2017 9:11 pm    Post subject: Reply with quote

Just tried out the second version of this code (with corrections) and it works really well! Great stuff.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> Algorithm development All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group