Reverb, adding more control

Algorithm development and general DSP issues

Moderator: frank

Post Reply
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Reverb, adding more control

Post by ice-nine »

I've been playing with some reverb code from one of the patches on the Spin site. It had a reverb time coefficient which was set that I am trying to make controllable by a pot. I have changed the code to what I thought should work and commented out the leftover code, but I am getting an error I am not sure about when assembling the code.
If anyone can run a quick eye over this and point me in the right direction that would be great.

Code: Select all

;Reverb from wah

;Pot0 = Reverb level Dry Mix
;Pot1 = Reverb Time
;pot2 = 

;memory declarations:

mem	ap1	334
mem	ap2	556
mem	ap3	871

mem	lap1a	808
mem	lap1b	1934
mem	d1	2489

mem	lap2a	1016
mem	lap2b	1787
mem	d2	2287

;register equates:

equ	krt	reg0
equ	mono	reg1
equ	apout	reg2
equ	lp1	reg3
equ	lp2	reg4
equ	revout	reg5

;declare constants:

equ	kap	0.6	;all pass coefficient
;equ	krt	0.6	;reverb time
equ	krf	0.5	;reverb lpf freq
equ	krs	-0.6	;reverb lpf shelf

;clear registers and initialize LFOs:

skp	run,endclr
wrax	lp1,0
wrax	lp2,0
wlds	sin0,12,100
endclr:

;Pot 0 read directly to control reverb level/mix

;Pot1 prepare decay 

rdax	pot1,0.96	;get pot. limit to less than infinate
log	0.5,0
exp	1,0		;square root pot0
sof	0.6,0.3		;ranges 0.3 to 0.9
wrax	krt,0		;write for later use

;sum inputs to mono:

rdax	adcl,0.5
rdax	adcr,0.5
wrax	mono,0	

;do reverb and put result in revout (after pot0 control):

rdax	mono,0.5
rda	ap1#,kap
wrap	ap1,-kap
rda	ap2#,kap
wrap	ap2,-kap
rda	ap3#,kap
wrap	ap3,-kap
wrax	apout,0

rda	d2#,krt
rdax	apout,1
rda	lap1a#,kap
wrap	lap1a,-kap
rda	lap1b#,kap
wrap	lap1b,-kap
rdfx	lp1,krf
wrlx	lp1,krs
wra	d1,0

rda	d1#,krt
rdax	apout,1
rda	lap2a#,kap
wrap	lap2a,-kap
rda	lap2b#,kap
wrap	lap2b,-kap
rdfx	lp2,krf
wrlx	lp2,krs
wra	d2,1.99
rda	d1,1.99
mulx	pot0
mulx	pot0
wrax	revout,0

;smooth reverb:

cho	rda,sin0,sin|reg|compc,lap1b+100
cho	rda,sin0,sin,lap1b+101
wra	lap1b+200,0
cho	rda,sin0,sin|reg|compc,lap2b+100
cho	rda,sin0,sin,lap2b+101
wra	lap2b+200,0

;now combine outputs to make a mixed signal 

rdax	mono,1
rdax	revout,1
wrax	dacl,0

and this is the error message i'm getting.

<0000>[ Pass 2] [ 1005] Line: 72 "rda d2#,krt " - ERROR:Coefficient out of range -
<0001>[ Pass 2] [ 1005] Line: 82 "rda d1#,krt " - ERROR:Coefficient out of range -
2 Log Messages
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Re: Reverb, adding more control

Post by frank »

Code: Select all

;Reverb from wah

<snip>

;register equates:

equ	krt	reg0
equ	mono	reg1
equ	apout	reg2
equ	lp1	reg3
equ	lp2	reg4
equ	revout	reg5

<snip>

and this is the error message i'm getting.

<0000>[ Pass 2] [ 1005] Line: 72 "rda d2#,krt " - ERROR:Coefficient out of range -
<0001>[ Pass 2] [ 1005] Line: 82 "rda d1#,krt " - ERROR:Coefficient out of range -
2 Log Messages
You cannot pass a register to RDA, you will need to recode that section.
Frank Thomson
Experimental Noize
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Post by ice-nine »

Thanks Frank,
I have edited from this,

Code: Select all

rda	d2#,krt
rdax	apout,1
to this

Code: Select all

rda	d2#,1
mulx	krt
rdax	apout,1
(both sections d2# d1#) Should do the trick I hope.

won't get a chance to plug in and test it until tomorrow, but it did compile ok this time.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

That looks like it will work, it looks like acc is 0 at that point so you can use mulx on it to scale the delay values. :)
Frank Thomson
Experimental Noize
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Post by ice-nine »

Yes that worked, I also altered the pot scaling to give a wider adjustment RT.
Next I will look at controlling the Damping with a pot as well.
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

I'm very interested in what you come up with.

I had adapted one of the reverb algorithms to take a pot for reverb time adjustment (I think it is the "minimum reverb" algorithm) and found that the single adjustment controlled time AND level together. Would be nice if these could be separated somehow.

Also if the coefficient goes much over 0.4 you are in HOWL territory.
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Post by ice-nine »

Digital Larry wrote:I'm very interested in what you come up with.

I had adapted one of the reverb algorithms to take a pot for reverb time adjustment (I think it is the "minimum reverb" algorithm) and found that the single adjustment controlled time AND level together. Would be nice if these could be separated somehow.

Also if the coefficient goes much over 0.4 you are in HOWL territory.
I altered a few bits of code and it is sounding ok , level and time work separately from pot1 and pot2. There is a little modulation sound in the tail of the reverb.

This is the working code.

Code: Select all

;Reverb for guitar modified from reverb/wah patch

;Pot0 = Unused
;Pot1 = Reverb level Dry Mix
;pot2 = Reverb Time

;memory declarations:

mem	ap1	334
mem	ap2	556
mem	ap3	871
mem	ap4	1343

mem	lap1a	808
mem	lap1b	1934
mem	d1	2489

mem	lap2a	1016
mem	lap2b	1787
mem	d2	2287

;register equates:

equ	krt	reg0
equ	mono	reg1
equ	apout	reg2
equ	lp1	reg3
equ	lp2	reg4
equ	revout	reg5

;declare constants:

equ	kap	0.6	;all pass coefficient
equ	krf	0.5	;reverb lpf freq
equ	krs	-0.6	;reverb lpf shelf

;clear registers and initialize LFOs:

skp	run,endclr
wrax	lp1,0
wrax	lp2,0
wlds	sin0,25,100
endclr:

;Pot 0 read directly to control reverb level/mix

;Pot2 prepare decay 

rdax	pot2,0.9		;get pot. limit to less than infinate
wrax	krt,0		;write for later use

;sum inputs to mono:

rdax	adcl,0.5
rdax	adcr,0.5
wrax	mono,0	

;do reverb and put result in revout (after pot1 control):

rdax	mono,0.5
rda	ap1#,kap
wrap	ap1,-kap
rda	ap2#,kap
wrap	ap2,-kap
rda	ap3#,kap
wrap	ap3,-kap
rda	ap4#,kap
wrap	ap4,-kap
wrax	apout,0

rda	d2#,1
mulx	krt
rdax	apout,1
rda	lap1a#,kap
wrap	lap1a,-kap
rda	lap1b#,kap
wrap	lap1b,-kap
rdfx	lp1,krf
wrlx	lp1,krs
wra	d1,0

rda	d1#,1
mulx	krt
rdax	apout,1
rda	lap2a#,kap
wrap	lap2a,-kap
rda	lap2b#,kap
wrap	lap2b,-kap
rdfx	lp2,krf
wrlx	lp2,krs
wra	d2,1.99
rda	d1,1.99
mulx	pot1
mulx	pot1
wrax	revout,0

;smooth reverb:

cho	rda,sin0,sin|reg|compc,lap1b+100
cho	rda,sin0,sin,lap1b+101
wra	lap1b+200,0
cho	rda,sin0,sin|reg|compc,lap2b+100
cho	rda,sin0,sin,lap2b+101
wra	lap2b+200,0

;now combine outputs to make a mixed signal 

rdax	mono,1
rdax	revout,1
wrax	dacl,0
I not sure how to get this into block for your SpinCad Designer as it doesn't seem to work fully on my PC.
I have been playing with the room and hall reverbs which sound much nicer.
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

Hi Ice-9, oh, I didn't realize you were having a problem with SpinCAD. You should tell me these things! :o Although I do know already that the RAMP LFOs don't work properly in the SIMULATOR, but are OK in the generated Spin ASM.

Please post what problem you're having over on my forum and I'll take a look.

Once you're happy with this reverb code, I can convert it into a block.

I'm developing some instructions for people who want to extend SpinCAD (since I don't have as much time these days, having found a "real job" (sigh)). However the instructions themselves are pretty complicated! :cry:
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Post by ice-nine »

Digital Larry wrote:Hi Ice-9, oh, I didn't realize you were having a problem with SpinCAD. You should tell me these things! :o Although I do know already that the RAMP LFOs don't work properly in the SIMULATOR, but are OK in the generated Spin ASM.

Please post what problem you're having over on my forum and I'll take a look.

Once you're happy with this reverb code, I can convert it into a block.

I'm developing some instructions for people who want to extend SpinCAD (since I don't have as much time these days, having found a "real job" (sigh)). However the instructions themselves are pretty complicated! :cry:
The code above works well so is worth making into a block as is.
I will go to the SpinCad forum and post over there but basically the problem I think is with my pc and not spincad, and its only that I cant get the audio in the simulator to work.
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

Are any of these parameters something you'd like to be able to adjust via SpinCAD control panel (i.e. not in real time)?

equ kap 0.6 ;all pass coefficient
equ krf 0.5 ;reverb lpf freq
equ krs -0.6 ;reverb lpf shelf

If so, please let me know what the adjustment range should be.

Thanks,

DL
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Post by ice-nine »

Digital Larry wrote:Are any of these parameters something you'd like to be able to adjust via SpinCAD control panel (i.e. not in real time)?

equ kap 0.6 ;all pass coefficient
equ krf 0.5 ;reverb lpf freq
equ krs -0.6 ;reverb lpf shelf

If so, please let me know what the adjustment range should be.

Thanks,

DL
Having a control panel for some settings sounds like a great addition I will have a bit experiment and see what range would be suited and get back to you if that's ok.
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

No problem sir!
ice-nine
Posts: 192
Joined: Thu May 24, 2012 9:03 am

Post by ice-nine »

After having a bit play around with this reverb, settings of between -0.1 and -1.99 give the greatest control with -1.99 giving the most cut for the krs value.
Post Reply