Csound Csound-dev Csound-tekno Search About

Re: global stereo balancing

Date1998-03-30 02:39
FromHans Mikelson
SubjectRe: global stereo balancing
Hi,

The following is extracted from a larger piece:

Good Luck,
Hans Mikelson

;---------------------------------------------------------------------------
; Mixer
;---------------------------------------------------------------------------
          instr 100
idur      init  p3
iamp      init  p4
inch      init  p5
ipan      init  p6
ifader    init  p7
ioutch    init  p8
asig1     zar   inch             ; Read input channel 1
kfader    oscil  1, 1/idur, ifader
kpanner   oscil  1, 1/idur, ipan
kgl1      =     kfader*sqrt(kpanner)    ; Left gain
kgr1      =     kfader*sqrt(1-kpanner)  ; Right gain
kdclick   linseg  0, .002, iamp, idur-.002, iamp, .002, 0  ; Declick
asigl     =     asig1*kgl1       ; Scale and sum
asigr     =     asig1*kgr1
          outs  kdclick*asigl, kdclick*asigr   ; Output stereo pair
          zaw   kdclick*kfader*asig1, ioutch   ; Output postfader
          endin
;---------------------------------------------------------------------------
-------
; Large Room Reverb
;---------------------------------------------------------------------------
-------
       instr  105
idur   =        p3
iamp   =        p4
iinch1 =        p5
igain1 =        p6
iinch2 =        p7
igain2 =        p8
iinch3 =        p9
igain3 =        p10
aout91 init     0
adel01 init     0
adel11 init     0
adel51 init     0
adel52 init     0
adel91 init     0
adel92 init     0
adel93 init     0
kdclick linseg  0, .002, iamp, idur-.004, iamp, .002, 0
ain1  zar       iinch1
ain2  zar       iinch2
ain3  zar       iinch3
asig0  =        igain1*ain1+igain2*ain2+igain3*ain3
aflt01 butterlp asig0, 4000            ; Pre-Filter
aflt02 butterbp .8*aout91, 1000, 500       ; Feed-Back Filter
asum01  =       aflt01+.5*aflt02       ; Initial Mix
; All-Pass 1
asub01  =       adel01-.3*asum01
adel01  delay   asum01+.3*asub01,.008
; All-Pass 2
asub11  =       adel11-.3*asub01
adel11  delay   asub01+.3*asub11,.012
; Delay 1
adel21  delay   asub11, .004
; Out 1
aout31  =       1.5*adel21
; Delay 2
adel41  delay   adel21, .017
; Single Nested All-Pass
asum51  =       adel52-.25*adel51
aout51  =       asum51-.5*adel41
adel51  delay   adel41+.5*aout51, .025
adel52  delay   adel51+.25*asum51, .062
; Delay 3
adel61  delay   aout51,.031
; Out 2
aout71  =       .8*adel61
; Delay 4
adel81  delay   adel61, .003
; Double Nested All-Pass
asum91  =       adel92-.25*adel91
asum92  =       adel93-.25*asum91
aout91  =       asum92-.5*adel81
adel91  delay   adel81+.5*aout91, .120
adel92  delay   adel91+.25*asum91, .076
adel93  delay   asum91+.25*asum92, .030
aout    =       .8*aout91+aout71+aout31
        outs      aout*kdclick, -aout*kdclick
        endin

;---------------------------------------------------------------------------
; Clear audio & control channels
;---------------------------------------------------------------------------
          instr 110
          zacl  0, 30          ; Clear audio channels 0 to 30
          zkcl  0, 30          ; Clear control channels 0 to 30
          endin

; Mixer Tables
; 3=FadeIn, 5=FadeOut, 6=Const1, 7=Const.5
f3  0 1024 -7 0  1024 1           ; UpSaw/FadeIn/PanRL
f4  0 1024 -7 0  512 1 512 0      ; Tri/Pan RLR/Fade In&Out
f5  0 1024 -7 1  1024 0           ; DnSaw/FadeOut/PanLR
f6  0 1024 -7 1  1024 1           ; Const1/PanL
f7  0 1024 -7 .5 1024 .5          ; Const.5/PanC
f8  0 1024 -7 0  1024 0           ; Const0/PanR
f9  0 1024 -7 0  256 1 768 1      ; Voice Amp
f10 0 1024 -7 .5 256 .2 768 .8    ; Voice Pan CRL
f11 0 1024 -7 .5 256 .8 768 .2    ; Voice Pan CLR
; Mixer 3=FadeIn, 5=FadeOut, 6=Const1, 7=Const.5, 8=Const0
;    Sta    Dur   Amp  Ch  Pan  Fader  OutCh
i100 0      10    .7   8   7    6      25
; Large Room Reverb
;    Sta   Dur    Amp  InCh1 Gain1 InCh2 Gain2 InCh3 Gain3
i105 0     10     0.2  22    1     23    1     25    1
;---------------------------------------------------------------------------
; Clear ZAK
;---------------------------------------------------------------------------
; Clear Channels
i110 0  10