Code: Select all
;
; Phil's vibrato code (simple, based on AN-0001)
;
;pot0 = speed
;pot1 = depth
;pot2 = nothing
mem delay 32767
;-----setup sine wave-----
skp run, endsetup
wlds sin0, 50, 64 ;freq = 2Hz [kf=2^17*(2piF/R)], Delay Length = 32 samples [Ka = N*32768/16385]
endsetup:
;-----read pot0 (rate)-----
ldax pot0
sof 0.4, 0.1 ;limit range 0.1 to 0.5 (2Hz to 10Hz)
wrax sin0_rate, 0 ;write sin0 rate
;-----read pot1 (depth)-----
rdax pot1, 0.003 ;limit pot1 range 0 to 0.003 (Ka(dec) = Ka/32768. So Ka range is 0 to 98.3 (0 samples to 49 samples)
wrax sin0_range, 0 ;write sin0 range
;-----do pitch shift-----
ldax adcl
wra delay, 0 ;write input to delay head
cho rda, sin0, sin|reg|compc, 100 ;
cho rda, sin0, sin, 101 ;interpolate between sin output of 100 and 101 (no chance of 49 samples colliding with delay head)
wrax dacl, 0 ;write pitch vibrato to output