Runge-Kutte numerical simulation of the Moog analog resonant filter.
Bob is based on bob~ by Miller Puckette in Pure Data. The design is based on the papers by Tim Stilson, Timothy E. Stinchcombe, and Antti Huovilainen.
Syntax
asig=bob(ain,xcf,xres,xsat[,iosamps,istor])
asigbobain,xcf,xres,xsat[,iosamps,istor]
Initialization
iosamps -- number of times of oversampling used in the filtering process. This will determine the maximum sharpness of the filter resonance (Q). More oversampling allows higher Qs, less oversampling will limit the resonance. The default is 2 times (iosamps=0).
istor -- initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.
Performance
asig -- input signal
xcf -- filter cutoff frequency
xres -- filter resonance. Nominally, a value of 4 should be the limit of stability -- above that, the filter oscillates.
xsat -- saturation. This parameter determines at what signal level the "transistors" in the model saturate. The maximum output amplitude is about 2/3 of that value.
According to bob~ manual page, "By default bob~ does one step of 4th-order Runge-Kutte integration per audio sample. This works OK for resonant/cutoff frequencies up to about 1/2 Nyquist. To improve accuracy and/or to extend the range of the filter to higher cutoff frequencies you can oversample by any factor - but note that computation time rises accordingly. At high cutoff frequencies/resonance values the RK approximation can go unstable. You can combat this by raising the oversampling factor.
The saturation parameter determines at what signal level the "transistors" in the model saturate. The maximum output amplitude is about 2/3 of that value".
Examples
Here is an example of the bob opcode. It uses the file bob-modern.csd.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac ;;;realtime audio out;-iadc ;;;uncomment -iadc if realtime audio input is needed too; For Non-realtime ouput leave only the line below:; -o bob.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1ga1=init(0)ga2=init(0)seed(777)instr7dur:i=p3a0=vco2(1,cpsmidinn(p4)); a saw wave to be filteredk1=jspline(0.7,0.7,1/0.7); add some jitter to filter resonancekA=linseg(0,dur/17,1,(17-2)*dur/17,1,dur/17,0); overal amplitude envelopek7=linseg(70,dur/3,700,dur/3,700,dur/3,70); filter cutoff envelopek77=expseg(sqrt(7),dur/2,7.7,dur/2,sqrt(7)); filter resonance modulationa1=bob(a0*kA,k7-k1*70,k77+k1,3); PD bob~ porteda1/=7; some normalization to avoid overloadaL=p5*a1; and then panningaR=a1*(1-p5)outs(aL,aR)ga1+=aL/7; AUX sendga2+=aR/7endininstr77; What a sound without some good reverb??a1,a2=reverbsc(ga1,ga2,0.97+0.1/7,7777)outs(a1,a2)ga1=0ga2=0endin</CsInstruments><CsScore>i7030700.7; Perfect 7thi7030770.7i77040; In text editor try Find and Replace to substitute all 7 numbers for 3...8 ); all 8s is a bit too high, all 3s is a bit too low, 4 sounds great!; Do such replacement in initial 7 file, otherwise avoid accidental changes in the header...; Tired of numerology? Try this:; i 7 0 30 60 0.6; i 7 0 32 45 0.4e</CsScore></CsoundSynthesizer>
Here is an example of the bob opcode. It uses the file bob.csd.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac ;;;realtime audio out;-iadc ;;;uncomment -iadc if realtime audio input is needed too; For Non-realtime ouput leave only the line below:; -o bob.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1ga1init0ga2init0seed777instr7a0vco21,cpsmidinn(p4); a saw wave to be filteredk1jspline0.7,0.7,1/0.7; add some jitter to filter resonancekAlinseg0,p3/17,1,(17-2)*p3/17,1,p3/17,0; overal amplitude envelopek7linseg70,p3/3,700,p3/3,700,p3/3,70; filter cutoff envelopek77expsegsqrt(7),p3/2,7.7,p3/2,sqrt(7); filter resonance modulationa1boba0*kA,k7-k1*70,k77+k1,3; PD bob~ porteda1/=7; some normalization to avoid overloadaL=p5*a1; and then panningaR=a1*(1-p5)outsaL,aRga1+=aL/7; AUX sendga2+=aR/7endininstr77; What a sound without some good reverb??a1,a2reverbscga1,ga2,0.97+.1/7,7777outsa1,a2ga1=0ga2=0endin</CsInstruments><CsScore>i7030700.7; Perfect 7thi7030770.7i77040; In text editor try Find and Replace to substitute all 7 numbers for 3...8 ); all 8s is a bit too high, all 3s is a bit too low, 4 sounds great!; Do such replacement in initial 7 file, otherwise avoid accidental changes in the header...; Tired of numerology? Try this:; i 7 0 30 60 0.6; i 7 0 32 45 0.4e</CsScore></CsoundSynthesizer>