;*************************************************************** ; ; A stereo reverb for the DSP56001 signal processor. ; Developed by Quinn Jensen using ; Dr. Vercoe and company's csound code as a reference for the ; configuration and gain values. ; ; NOTE - A much improved reverb algorithm is in sixcomb.a56 ; ; This program fragment implements a stereo reberb effect ; on a DSP56001 processor. The "depth" and wet/dry mix are ; adjustable. The following filter configuration is employed: ; ; ; Left in ------+------- "dry" gain -----------> sum -----> Left out ; | ^ ; v | ; sum --> reverb --> "wet" gain -----+ ; ^ | ; | v - ; Right in -----+------- "dry" gain -----------> sum -----> Right out ; ; ; Note that the reverb path output is negated before summing with the ; right input signal. This throws in 180 degrees of phase shift ; making for interesting results even with mono inputs ; (i.e. Left in == Right in). ; ; The reverb element looks like this: ; ; ; Input ----+-----> comb1 ------+ ; | | ; +-----> comb2 ---\ v ; | sum -----> allpass1 --> allpass2 ---> output ; +-----> comb3 ---/ ^ ; | | ; +-----> comb4 ------+ ; ; Each comb stage looks like this: ; ; +---- gain <-----+ ; | | ; v | ; Input ---> gain ----> sum ---> delay ---+--> out ; ; ; The allpass stages look like: ; ; +--------- gain <---------+ ; | | ; v | ; Input ---> gain --+--> sum ---> delay ---> sum ---+----> out ; | ^ ; | | ; +--------> gain ----------+ ; ; or, ; ; +-------> gain ----+ ; | | ; | v ; Input ---> gain ----> sum --+--> delay --+--> sum -----> out ; ^ | ; | | ; +----- gain <-----+ ; ; ; I've seen both configurations in the literature, so I plotted the ; Z-transform and they are equivalent in the steady state. They are indeed ; all-pass in the steady state but are supposed to have a subtle, discernable ; effect in "transient" audio signals. ; ; I think it could really use a couple more comb stages to fill in some of the ; graininess. The best possible "diffusion" is desired. By the way, ; I'd enjoy seeing any optimizations to the code. ; ;hardware specific initialization code include "tdsg.a56" ;*************************************************************** ; ; Data and constants ; ;*************************************************************** P:0076 dot ;remember where we were in P-space X:0010 org x:$10 ;put runtime variables in on-chip X-space ; A spreadsheet was used to calculate the following numbers ; ; The gain of each feedback stage is given by ; ; feedback gain = exp(delay * ln(.001)/duration) ; ; where "delay" is the delay of the comb or allpass stage in seconds, ; and "duration" is the time in seconds for the reverberated sound ; to decay to 1/1000 of its original amplitude. ; ; Reverb filter lengths and coefficients ; Sun Aug 4 16:36:16 1991 ; ; Sample rate 32.5520830 kHz ; Reverb duration 4.0000000 s ; ; stage delay(ms) length gain actual ; ----------------------------------------------------- ; Comb1 29.7000000 967 0.9500031 29.71 ; Comb2 37.1000000 1208 0.9379399 37.11 ; Comb3 41.1000000 1338 0.9314831 41.10 ; Comb4 43.7000000 1423 0.9273101 43.71 ; All-1 5.0000000 163 0.9914025 5.01 ; All-2 1.7000000 55 0.9970685 1.69 0.340909 in_atten equ 0.3409091 0.0416667 comb_atten equ 0.0416667 0.4 dry_init equ 0.4000000 ; initial "dry" gain 0.99 reverb_init equ 0.9900000 ; initial "wet" gain ; comb 1 data and parameters 004000 c1d equ $4000 X:0010 004000 c1r dc c1d 0003C6 c1m equ 966 0.950003 c1c equ 0.9500031 ; comb 2 data and parameters 004800 c2d equ c1d+ 2048 X:0011 004800 c2r dc c2d 0004B7 c2m equ 1207 0.93794 c2c equ 0.9379399 ; comb 3 data and parameters 005000 c3d equ c2d+ 2048 X:0012 005000 c3r dc c3d 000539 c3m equ 1337 0.931483 c3c equ 0.9314831 ; comb 4 data and parameters 005800 c4d equ c3d+ 2048 X:0013 005800 c4r dc c4d 00058E c4m equ 1422 0.92731 c4c equ 0.9273101 ; allpass 1 data and parameters 006000 a1d equ c4d+ 2048 X:0014 006000 a1r dc a1d 0000A2 a1m equ 162 0.991403 a1c equ 0.9914025 ; allpass 2 data and parameters 006800 a2d equ a1d+ 2048 X:0015 006800 a2r dc a2d 000036 a2m equ 54 0.997068 a2c equ 0.9970685 Y:0000 org y:$0 0.99 reverb_on equ reverb_init 000000 reverb_off equ 0 Y:0000 reverb_gain Y:0000 7EB852 dc reverb_on Y:0001 dry_gain Y:0001 333333 dc dry_init P:0076 org p:dot ;go back to P-space ;***************************************************** ; ; reverb initialization code ; ;***************************************************** P:0076 hf_init P:0076 00000C rts ;***************************************************** ; ; run-time controls ; ;***************************************************** P:0077 eff1_on ;enable reverb P:0077 46F400 move #reverb_on,y0 P:0078 7EB852 P:0079 4E0000 move y0,y: