bob
Prev | Orchestra Opcodes and Operators | Next

## bob

bob — Runge-Kutte numerical simulation of the Moog analog resonant filter.

## Description

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]

## 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.csd.

Example 102. Example of the bob 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   ;;;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 = 44100
    ksmps = 32
    nchnls = 2
    0dbfs  = 1

    ga1 init 0
    ga2 init 0

        seed 777

    instr 7
    a0  vco2     1, cpsmidinn(p4) ; a saw wave to be filtered
    k1  jspline  0.7, 0.7, 1/0.7; add some jitter to filter resonance
    kA  linseg   0,        p3/17, 1,     (17-2)*p3/17, 1,   p3/17, 0; overal amplitude envelope
    k7  linseg   70,       p3/3,  700,   p3/3,     700,     p3/3,  70; filter cutoff envelope
    k77 expseg   sqrt(7),  p3/2,  7.7,   p3/2,     sqrt(7); filter resonance modulation
    a1  bob      a0 * kA, k7 - k1 * 70, k77 + k1, 3; PD bob~ ported
    a1           /= 7; some normalization to avoid overload
    aL           = p5 * a1; and then panning
    aR           = a1 * (1 - p5)
        outs     aL, aR

    ga1          +=  aL/7; AUX send
    ga2          +=  aR/7
    endin

    instr 77 ; What a sound without some good reverb??
    a1,a2  reverbsc ga1,ga2, 0.97+.1/7, 7777
        outs     a1, a2
    ga1          = 0
    ga2          = 0
    endin
    </CsInstruments>
    <CsScore>
    i 7  0 30 70 0.7; Perfect 7th
    i 7  0 30 77 0.7
    i 77 0 40
    ; 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.4

    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

moogladder

## Credits

By: Gleb Rogozinsky 2020

New in version 6.15

Prev | Up | Next
birnd | Home | bpf