babo — A physical model reverberator.
babo stands for ball-within-the-box. It is a physical model reverberator based on the paper by Davide Rocchesso "The Ball within the Box: a sound-processing metaphor", Computer Music Journal, Vol 19, N.4, pp.45-47, Winter 1995.
The resonator geometry can be defined, along with some response characteristics, the position of the listener within the resonator, and the position of the sound source.
irx, iry, irz -- the coordinates of the geometry of the resonator (length of the edges in meters)
idiff -- is the coefficient of diffusion at the walls, which regulates the amount of diffusion (0-1, where 0 = no diffusion, 1 = maximum diffusion - default: 1)
ifno -- expert values function: a function number that holds all the additional parameters of the resonator. This is typically a GEN2--type function used in non-rescaling mode. They are as follows:
decay -- main decay of the resonator (default: 0.99)
hydecay -- high frequency decay of the resonator (default: 0.1)
rcvx, rcvy, rcvz -- the coordinates of the position of the receiver (the listener) (in meters; 0,0,0 is the resonator center)
rdistance -- the distance in meters between the two pickups (your ears, for example - default: 0.3)
direct -- the attenuation of the direct signal (0-1, default: 0.5)
early_diff -- the attenuation coefficient of the early reflections (0-1, default: 0.8)
asig -- the input signal
ksrcx, ksrcy, ksrcz -- the virtual coordinates of the source of sound (the input signal). These are allowed to move at k-rate and provide all the necessary variations in terms of response of the resonator.
Here is a simple example of the babo opcode. Play babo.csd, and beats.wav
Example 85. A simple example of the babo opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform -odac ;;;RT audio out ;-iadc ;;;uncomment -iadc if RT audio input is needed too ; For Non-realtime ouput leave only the line below: ; -o babo.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> /* Written by Nicola Bernardini */ sr = 44100 ksmps = 32 nchnls = 2 ; minimal babo instrument ; instr 1 ix = p4 ; x position of source iy = p5 ; y position of source iz = p6 ; z position of source ixsize = p7 ; width of the resonator iysize = p8 ; depth of the resonator izsize = p9 ; height of the resonator ainput soundin "beats.wav" al,ar babo ainput*0.7, ix, iy, iz, ixsize, iysize, izsize outs al,ar endin </CsInstruments> <CsScore> /* Written by Nicola Bernardini */ ; simple babo usage: ; ;p4 : x position of source ;p5 : y position of source ;p6 : z position of source ;p7 : width of the resonator ;p8 : depth of the resonator ;p9 : height of the resonator ; i 1 0 20 6 4 3 14.39 11.86 10 ; ^^^^^^^ ^^^^^^^^^^^^^^ ; ||||||| ++++++++++++++: optimal room dims according to ; ||||||| Milner and Bernard JASA 85(2), 1989 ; +++++++++: source position e </CsScore> </CsoundSynthesizer>
Here is an advanced example of the babo opcode. Play babo_expert.csd, and beats.wav
Example 86. An advanced example of the babo opcode.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform -odac ;;;RT audio out ;-iadc ;;;uncomment -iadc if RT audio input is needed too ; For Non-realtime ouput leave only the line below: ; -o babo_expert.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> /* Written by Nicola Bernardini */ sr = 44100 ksmps = 32 nchnls = 2 ; full blown babo instrument with movement ; instr 2 ixstart = p4 ; start x position of source (left-right) ixend = p7 ; end x position of source iystart = p5 ; start y position of source (front-back) iyend = p8 ; end y position of source izstart = p6 ; start z position of source (up-down) izend = p9 ; end z position of source ixsize = p10 ; width of the resonator iysize = p11 ; depth of the resonator izsize = p12 ; height of the resonator idiff = p13 ; diffusion coefficient iexpert = p14 ; power user values stored in this function ainput soundin "beats.wav" ksource_x line ixstart, p3, ixend ksource_y line iystart, p3, iyend ksource_z line izstart, p3, izend al,ar babo ainput*0.7, ksource_x, ksource_y, ksource_z, ixsize, iysize, izsize, idiff, iexpert outs al,ar endin </CsInstruments> <CsScore> /* Written by Nicola Bernardini */ ; full blown instrument ;p4 : start x position of source (left-right) ;p5 : end x position of source ;p6 : start y position of source (front-back) ;p7 : end y position of source ;p8 : start z position of source (up-down) ;p9 : end z position of source ;p10 : width of the resonator ;p11 : depth of the resonator ;p12 : height of the resonator ;p13 : diffusion coefficient ;p14 : power user values stored in this function ; decay hidecay rx ry rz rdistance direct early_diff f1 0 8 -2 0.95 0.95 0 0 0 0.3 0.5 0.8 ; brighter f2 0 8 -2 0.95 0.5 0 0 0 0.3 0.5 0.8 ; default (to be set as) f3 0 8 -2 0.95 0.01 0 0 0 0.3 0.5 0.8 ; darker f4 0 8 -2 0.95 0.7 0 0 0 0.3 0.1 0.4 ; to hear the effect of diffusion f5 0 8 -2 0.9 0.5 0 0 0 0.3 2.0 0.98 ; to hear the movement f6 0 8 -2 0.99 0.1 0 0 0 0.3 0.5 0.8 ; default vals ; ^ ; ----- gen. number: negative to avoid rescaling i2 0 10 6 4 3 6 4 3 14.39 11.86 10 1 6 ; defaults i2 + 4 6 4 3 6 4 3 14.39 11.86 10 1 1 ; hear brightness 1 i2 + 4 6 4 3 -6 -4 3 14.39 11.86 10 1 2 ; hear brightness 2 i2 + 4 6 4 3 -6 -4 3 14.39 11.86 10 1 3 ; hear brightness 3 i2 + 3 .6 .4 .3 -.6 -.4 .3 1.439 1.186 1.0 0.0 4 ; hear diffusion 1 i2 + 3 .6 .4 .3 -.6 -.4 .3 1.439 1.186 1.0 1.0 4 ; hear diffusion 2 i2 + 4 12 4 3 -12 -4 -3 24.39 21.86 20 1 5 ; hear movement ; i2 + 4 6 4 3 6 4 3 14.39 11.86 10 1 1 ; hear brightness 1 i2 + 4 6 4 3 -6 -4 3 14.39 11.86 10 1 2 ; hear brightness 2 i2 + 4 6 4 3 -6 -4 3 14.39 11.86 10 1 3 ; hear brightness 3 i2 + 3 .6 .4 .3 -.6 -.4 .3 1.439 1.186 1.0 0.0 4 ; hear diffusion 1 i2 + 3 .6 .4 .3 -.6 -.4 .3 1.439 1.186 1.0 1.0 4 ; hear diffusion 2 i2 + 4 12 4 3 -12 -4 -3 24.39 21.86 20 1 5 ; hear movement ; ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^ ^ ; ||||||||||||||||||| ||||||||||||||||| | --: expert values function ; ||||||||||||||||||| ||||||||||||||||| +--: diffusion ; ||||||||||||||||||| ----------------: optimal room dims according to Milner and Bernard JASA 85(2), 1989 ; ||||||||||||||||||| ; --------------------: source position start and end e </CsScore> </CsoundSynthesizer>