Adding the original back in with the affected signal

Algorithm development and general DSP issues

Moderator: frank

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

Adding the original back in with the affected signal

Post by B.C. »

Hey guys,

So I have some algorithms I like, but I can't seem to add the original signal back in with the effected. I assume that this could be done by storing the original signal in a register and then reading it out and adding it with the affected. However, in trying this I get the clipping light to continually activate and no sound to be heard. Any suggestions will be great. O and just so you guys know I am new to the chip but have assembly experience.

~Brandon
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

You should post your code, so we can see what you're doing exactly. But you don't need to save the original to a register, you can just read it again at the end, like:

rdax adcr,1 ;read input
;do some stuff, generate effected signal
mulx pot0 ;volume for effect
wrax effect,0 ;create effect register, clear accum
rdax adcr,.5 ;read clean again
mulx pot ;clean volume
rdax effect,.5 ;read in effect

wrax dacr,0 ;write to output
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Post by B.C. »

Ok, very cool.

I would post the code but I already deleted it. I'll give this a shot and we can go from there.

Thank you for your help!
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

No problem. :D I've only been at this for a couple of months, so after asking a ton of questions here, I'm happy to be able to answer one or two.
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Post by B.C. »

Ok, so I tried to incorporate the dry volume, but now all I get is unaffected signal. Here is some code:
equ effect reg14 ; Setting up register
;Processing
rda del1+2630, .5 ;sum outputs as taps from reverb ring
rda del2+1943, .7
rda del3+3200, 1
rda del4+4016, 1.5
wrax dacl, 0.0
;

Note, the increasing coeff. are for reverse reverb
;Clean blend
mulx POT2
wrax effect, 0
rdax adcl, .5
rdax effect, .5
wrax dacl, 0.0
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

B.C. wrote:Ok, so I tried to incorporate the dry volume, but now all I get is unaffected signal. Here is some code:
equ effect reg14 ; Setting up register
;Processing
rda del1+2630, .5 ;sum outputs as taps from reverb ring
rda del2+1943, .7
rda del3+3200, 1
rda del4+4016, 1.5
wrax dacl, 0.0
;

Note, the increasing coeff. are for reverse reverb
;Clean blend
mulx POT2
wrax effect, 0
rdax adcl, .5
rdax effect, .5
wrax dacl, 0.0
Here's your problem in red. This line writes the effect to the left output (WRAX DACL) and the "0.0" part of that line clears the effected signal from the accumulator. You don't want to do either of those things. You need the effected signal to be in the accumulator before you write it to the "effect" register in order to use that code I posted, and also you don't really want to write to the same output twice (I actually don't know what effect this has, but there's no reason to do it and it could potentially screw things up).

Also, you removed the clean volume control, so if you take out the red line from above, it should work, but you won't have control over the clean volume. To do a mix control, which pans from 100% reverb to 100% clean, you do this:

Code: Select all

equ     effect    reg14 ; Setting up register
;Processing
rda     del1+2630,     .5     ;sum outputs as taps from reverb ring
rda     del2+1943,     .7
rda     del3+3200,     1
rda     del4+4016,     1.5
wrax   effect,     0

;Clean blend

RDAX  	effect,-1  	;read 'A' signal, with opposite sign
RDAX 	adcl,1 	;read 'B' signal, add to the A signal
MULX 	pot0 	;multiply by the xfade coefficient (pot derived)
RDAX 	effect,1 	;add back the A signal with correct sign
wrax         dacl,0
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Post by B.C. »

Makes sense! Thank you for all your help! Like I said, I have assembly language experience (Atmel AVR Micro) but this is a tad different. :)
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

Maybe sometime you can help me with AVRs...
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Post by B.C. »

More than happy to :)
B.C.
Posts: 38
Joined: Sat Mar 06, 2010 5:28 pm

Post by B.C. »

Hey Livingston,
Just got done testing my algorithm and it is perfect. Thank you for all your help!

~Brandon
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Post by livingston »

Cool, glad I could help. I'll just take 5% of your profits as a consultant's fee. :wink:
Post Reply