Pitch Reverb

Algorithm development and general DSP issues

Moderator: frank

Post Reply
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Pitch Reverb

Post by B.C. »

Hey there guys!

Hope all is well. I am trying to make a reverb that has a short delay but the pitch is up one octave. Here is what I have that doesn't quite work.

;Reverb with Pitch Shift
;Brandon Coventry
;03/16/10
;POT0 - Reverb Time
;POT1 - Pitch Shift
;POT2 - Clean Signal
;Lucas Molina Chip
;
mem lap1 156
mem lap2 223
mem lap3 331
mem lap4 546

;
mem ap1 1251
mem ap1b 1751
mem ap2 1443
mem ap2b 1343
mem ap3 1582
mem ap3b 1981

;
mem del1 5859
mem del2 4145
mem del3 3476
mem del4 4568
;
mem ocdelay 4096
mem temp1 1;temporary mem for partial calculations
;
equ temp reg0
equ rt reg1
equ pd reg2
equ effect reg3
equ lapout reg4
equ rapout reg5
;
;set up SIN LFO, .5Hz, +/-20 samples.
skp run, loop; if not first iteration, skip instruction
loop:

;set up RAMP LFO.
wldr RMP0, 16384,4096 ;octave up delay
;
;Smear 2 allpass filters in reverb ring:

cho rda, sin0, 0x06, ap1+50
cho rda, sin0, 0, ap1+51
wra ap1+100,
cho rda, sin0, 0x07, ap3+50
cho rda, sin0, 1, ap3+51
wra ap3+100, 0

;Prepare pots for control:
rdax POT0, 1.0
sof 0.8, 0.1
wrax rt, 0
;
rdax POT1, 1.0
sof 0.8, 0.1
wrax pd, 0
;
rdax POT2, 1.0
sof 0.8, 0.1
wrax effect, 0
;
;Get inputs and process with four APs each
;
rdax adcl, 0.5
rda lap1#, -0.5
wrap lap1, 0.5
rda lap2#, -0.5
wrap lap2, 0.5
rda lap3#, -0.5
wrap lap3, 0.5
rda lap4#, -0.5
wrap lap4, 0.5
wrax lapout, 0
;
;Now do reverb ring and use pitch shift algorithm.
;
;delay ap into 1:
rda del3#, 1.0 ;read previous delay
mulx rt ;multiply by reverb time coeff
rdax lapout, 1.0 ;read left input from input allpass filtere bank
rda ap1#, -0.6
wrap ap1, 0.6
rda ap1b#, -0.6
wrap ap1b, 0.6
wrax temp, 1.0
wra ocdelay, 0
cho rda,RMP0,REG|COMPC,ocdelay
cho rda,RMP0,,ocdelay+1
wra temp1, 0
cho rda,RMP0,RPTR2|COMPC,ocdelay
cho rda,RMP0,RPTR2,ocdelay+1
cho sof,RMP0,NA|COMPC,0
cho rda,RMP0,NA,temp
mulx POT1
wrax reg0,0
wra del1, 0.0 ;write to next delay
;
;delay ap into 2:
rda del2#, 1.0
mulx rt
rda ap2#, -0.6
wrap ap2, 0.6
rda ap2b#, -0.6
wrap ap2b, 0.6
wrax temp, 1.0
wra ocdelay, 0
cho rda,RMP0,REG|COMPC,ocdelay
cho rda,RMP0,,ocdelay+1
wra temp1, 0
cho rda,RMP0,RPTR2|COMPC,ocdelay
cho rda,RMP0,RPTR2,ocdelay+1
cho sof,RMP0,NA|COMPC,0
cho rda,RMP0,NA,temp
mulx POT1
wrax reg0,0
wra del2, 0.0
;
;delay ap into 3:
;
rda del2#, 1.0
mulx rt
rdax rapout, 1.0
rda ap3#, -0.6
wrap ap3, 0.6
rda ap3b#, -0.6
wrap ap3b, 0.6
wrax temp, 1.0
wra ocdelay, 0
cho rda,RMP0,REG|COMPC,ocdelay
cho rda,RMP0,,ocdelay+1
wra temp1, 0
cho rda,RMP0,RPTR2|COMPC,ocdelay
cho rda,RMP0,RPTR2,ocdelay+1
cho sof,RMP0,NA|COMPC,0
cho rda,RMP0,NA,temp
mulx POT1
wrax reg0,0
wra del3, 0.0
;

rda del1+2630, 1.5
rda del2+1943, 1.0
rda del3+3200, .7
rda del4+4016, 1.5
wrax effect, 0.0

;Clean Blend

rdax effect, -1
rdax adcl, 1
mulx POT2
rdax effect, 1
wrax dacl, 0
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

When it doesn't work right, it's easiest to diagnose when you tell us what it's doing, and what it's not doing. So what works; doesn't?

Your line

wldr RMP0, 16384,4096 ;octave up delay

needs to go inside the skp run, loop routine, which currently doesn't have anything inside it.
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Post by B.C. »

Thank you, I fixed that line.

As of right now, it doesn't do anything. No sound save the dry signal.
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

I see this a couple of times:

wrax reg0,0
wra del1, 0.0 ;write to next delay

This is bad for a couple of reasons. One, you have reg0 equated to "temp" but then you're writing something else to it that's unrelated. It might be a problem or might not, but it's a bad habit IMO. I wouldn't ever just use "REG0" or any other register name directly in your code, instead equate all your registers at the top to some word, so you know you're not using a register twice for 2 things.

But the real problem is that in that line, you're emptying the accumulator before you save it to the "DEL1", etc. registers. The accumulator is where your sound is, so if you zero it and then save it somewhere, you're just saving silence. To keep the signal in the accumulator so you can write it to "del1", change "wrax reg0, 0" to "wrax reg0, 1" except you should also change "reg0" to some word and then equate it at the top.
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Post by B.C. »

Wow! I see it! Thank you so much! I love having another set of eyes look over this. Thank you!
Post Reply