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 

New Phaser code

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



Joined: 21 May 2012
Posts: 13

PostPosted: Fri Oct 20, 2017 4:34 am    Post subject: New Phaser code Reply with quote

Hey guys,

I've been working on an enhanced version of the GT_DEMO Phaser code.

I really don't know DSP and this is the first program I've done for the FV-1. I just beat / hacked it into submission, not really knowing what I was doing.

Iíve now got a great sounding phaser with LFO, Depth / Manual, and # of stages (4,6,8,10). Iíve decided to give back to the Spin community and post the finished code (copy attached).

BTW Ė it took every last bloody program line!!!!

Enjoy

Doug

Code:

;Slocum Phase shifter  (From GA_DEMO - mods by Doug Slocum 10/20/2017)
; Uses every last bloody program line!

;Pot0 = Phase rate (manual if fully CCW)
;Pot1 = Sweep width (or manual)
;Pot2 = Num of Stages (4,6,8,10)


;register equates:

equ   mono   reg0
equ   lp1   reg1
equ   lp2   reg2
equ   phase   reg3
equ   p1   reg4
equ   p2   reg5
equ   p3   reg6
equ   p4   reg7
equ   p5   reg8
equ   p6   reg9
equ   p7   reg10
equ   p8   reg11
equ   p9   reg12
equ   p10   reg13
equ   temp   reg14
equ   temp1   reg15


;clear registers and initialize LFOs:

skp   run,endclr

wrax   lp1,0
wrax   lp2,0
wlds   sin0,12,100     ;sin0 used for phaser operations
wlds   sin1,0,32767    ;sin1 used for LFO

endclr:

;sum inputs to mono:
rdax   adcl, 0.5
rdax   adcr, 0.5
wrax   mono, 0

;Do phase shifter from sin1
; Manual or LFO mode test
ldax    pot0           ;read pot0, if it's zero then accumulator will be zero, else it will be positive
skp    zro, MANUAL      ;if zero, then skip to MANUAL otherwise do LFO stuff

;LFO stuff
rdax   pot0, 1
mulx   pot0
sof   0.12, 0.003
wrax   sin1_rate, 0
cho   rdal, sin1      ;read sin1 as +/-1
sof   0.5,0.5      ;make positive only sin ranges 0 to 1
log   0.5,0
exp   1,0      ;square root function
sof   1,-0.5      ;make +/-0.5
sof   1.999,0      ;make +/-1 again
mulx   pot1      ;pot1 controls phaser depth
sof   0.26,0.72

skp    gez, PHASER   ;accumulator will always be positive so skip to PHASER:


MANUAL:
rdax   pot1, 1
mulx    pot1   ;multiply by pot1 for variable range
sof   -.999,.999
log   0.9, 0
exp   1,0


PHASER:
wrax    phase,0   ;write to modulation register

rdax   mono, 1/64   ;input to phase shift network
wrax   temp1, 0   ; save it away

; pot ship routines for selecting number of stages
rdax   pot2, 1
and   %01100000_00000000_00000000     ;mask off only 2 bits, leaving only 4 possibilities
skp   zro,STAGES4   ;if zero, the skip over other code to reverb1
sof   1,-0.25   ;subtract 1/4
skp   zro,STAGES6   ;if zero, skip over other code to reverb2
sof   1,-0.25   ;subtract 1/4
skp   zro,STAGES8   ;if zero, skip over other code to reverb3
clr       ;clear the accumulator, there's 1/4 left in it!


STAGES10:
rdax   p1,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p1,-1
mulx   phase
rdax   temp,1
wrax   temp1,0

rdax   p2,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p2,-1
mulx   phase
rdax   temp,1
wrax   temp1,0


STAGES8:
rdax   p3,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p3,-1
mulx   phase
rdax   temp,1
wrax   temp1,0

rdax   p4,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p4,-1
mulx   phase
rdax   temp,1
wrax   temp1,0


STAGES6:
rdax   p5,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p5,-1
mulx   phase
rdax   temp,1
wrax   temp1,0

rdax   p6,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p6,-1
mulx   phase
rdax   temp,1
wrax   temp1,0


STAGES4:
rdax   p7,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p7,-1
mulx   phase
rdax   temp,1
wrax   temp1,0

rdax   p8,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p8,-1
mulx   phase
rdax   temp,1
wrax   temp1,0

rdax   p9,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p9,-1
mulx   phase
rdax   temp,1
wrax   temp1,0

rdax   p10,1
wrax   temp,1
mulx   phase
rdax   temp1,1
wrax   p10,-1
mulx   phase
rdax   temp,1


sof   -2,0
sof   -2,0
sof   -2,0
sof   -2,0
sof   -2,0
sof   -2,0   ;output of phase shifter in acc

rdax   mono,1
wrax   dacl,1
sof   1,-0.04
wrax   dacr,0

Back to top
View user's profile Send private message Visit poster's website
donstavely



Joined: 07 Jan 2010
Posts: 52
Location: Windsor, Colorado

PostPosted: Fri Oct 20, 2017 10:16 am    Post subject: Reply with quote

Good stuff, Doug. I also find that I fight for every instruction.

A couple of things that might save a few lines: The final "sof 1, -0.04" I believe was only necessary to avoid a glitch around zero in the D/A converter on an early rev of the FV-1. Note that there was a "sof 1, 0.02" on the other channel in the original GA code. Maybe Frank can clarify.

Also, there is the 64X attenuation before the phaser code, and then six "sof -2, 0" lines to gain it back up again. This seems like overkill for avoiding clipping in the math. Maybe 4X would be more reasonable. Again, it would be good for Frank to weigh in.
_________________
Don Stavely
Back to top
View user's profile Send private message
dslocum



Joined: 21 May 2012
Posts: 13

PostPosted: Fri Oct 20, 2017 12:31 pm    Post subject: Reply with quote

I actually have very little idea what you are referring to, as I really don't have the Spin chops yet, and may never.. But I'm happy to have the "experts" chime in and help me learn. And if it helps someone else, that's good too.!!!
Back to top
View user's profile Send private message Visit poster's website
Digital Larry



Joined: 12 Nov 2012
Posts: 274

PostPosted: Sat Oct 21, 2017 8:04 am    Post subject: Reply with quote

You can delete these references as well:

equ lp1 reg1
equ lp2 reg2

wrax lp1,0
wrax lp2,0

lp1 and lp2 are never used beyond being cleared to zero at init time.

Call me crazy but I generally skip clearing my filter registers at init time. I suppose it might cause a pop under some circumstances but I don't recall it ever being an issue. YMMV of course.
Back to top
View user's profile Send private message Visit poster's website
donstavely



Joined: 07 Jan 2010
Posts: 52
Location: Windsor, Colorado

PostPosted: Sat Oct 21, 2017 9:17 am    Post subject: Reply with quote

Not crazy.

No need to clear registers at run time.
_________________
Don Stavely
Back to top
View user's profile Send private message
ice-nine



Joined: 24 May 2012
Posts: 125

PostPosted: Sat Oct 21, 2017 9:22 am    Post subject: Reply with quote

Digital Larry wrote:
You can delete these references as well:

equ lp1 reg1
equ lp2 reg2

wrax lp1,0
wrax lp2,0

lp1 and lp2 are never used beyond being cleared to zero at init time.

Call me crazy but I generally skip clearing my filter registers at init time. I suppose it might cause a pop under some circumstances but I don't recall it ever being an issue. YMMV of course.


Yeah remove those lines, they were used for LPF in the reverb code which has been totally removed anyway.
_________________
www.stanleyfx.co.uk
"It's fairly straight forward, if you want to start it press start, you can work out the rest of the controls yourself."
Back to top
View user's profile Send private message Visit poster's website
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