oscbnk
Mixes the output of any number of oscillators.
This unit generator mixes the output of any number of oscillators. The frequency, phase, and amplitude of each oscillator can be modulated by two LFOs (all oscillators have a separate set of LFOs, with different phase and frequency); additionally, the output of each oscillator can be filtered through an optional parametric equalizer (also controlled by the LFOs). This opcode is most useful for rendering ensemble (strings, choir, etc.) instruments.
Although the LFOs run at k-rate, amplitude, phase and filter modulation are interpolated internally, so it is possible (and recommended in most cases) to use this unit at low (~1000 Hz) control rates without audible quality degradation.
The start phase and frequency of all oscillators and LFOs can be set by a built-in seedable 31-bit random number generator, or specified manually in a function table (GEN2).
Syntax
ares oscbnk kcps, kamd, kfmd, kpmd, iovrlap, iseed, kl1minf, kl1maxf, \
kl2minf, kl2maxf, ilfomode, keqminf, keqmaxf, keqminl, keqmaxl, \
keqminq, keqmaxq, ieqmode, kfn [, il1fn] [, il2fn] [, ieqffn] \
[, ieqlfn] [, ieqqfn] [, itabl] [, ioutfn]
Initialization
iovrlap -- Number of oscillator units.
iseed -- Seed value for random number generator (positive integer in the range 1 to 2147483646 (2 ^ 31 - 2)). iseed <= 0 seeds from the current time.
ieqmode -- Parametric equalizer mode
- -1: disable EQ (faster)
- 0: peak
- 1: low shelf
- 2: high shelf
- 3: peak (filter interpolation disabled)
- 4: low shelf (interpolation disabled)
- 5: high shelf (interpolation disabled)
The non-interpolated modes are faster, and in some cases (e.g. high shelf filter at low cutoff frequencies) also more stable; however, interpolation is useful for avoiding zipper noise
at low control rates.
ilfomode -- LFO modulation mode, sum of:
- 128: LFO1 to frequency
- 64: LFO1 to amplitude
- 32: LFO1 to phase
- 16: LFO1 to EQ
- 8: LFO2 to frequency
- 4: LFO2 to amplitude
- 2: LFO2 to phase
- 1: LFO2 to EQ
If an LFO does not modulate anything, it is not calculated, and the ftable number (il1fn or il2fn) can be omitted.
il1fn (optional: default=0) -- LFO1 function table number. The waveform in this table has to be normalized (absolute value <= 1), and is read with linear interpolation.
il2fn (optional: default=0) -- LFO2 function table number. The waveform in this table has to be normalized, and is read with linear interpolation.
ieqffn, ieqlfn, ieqqfn (optional: default=0) -- Lookup tables for EQ frequency, level, and Q (optional if EQ is disabled). Table read position is 0 if the modulator signal is less than, or equal to -1, (table length / 2) if the modulator signal is zero, and the guard point if the modulator signal is greater than, or equal to 1. These tables have to be normalized to the range 0 - 1, and have an extended guard point (table length = power of two + 1). All tables are read with linear interpolation.
itabl (optional: default=0) -- Function table storing phase and frequency values for all oscillators (optional). The values in this table are in the following order (5 for each oscillator unit):
All values are in the range 0 to 1; if the specified number is greater than 1, it is wrapped (phase) or limited (frequency) to the allowed range. A negative value (or end of table) will use the output of the random number generator. The random seed is always updated (even if no random number was used), so switching one value between random and fixed will not change others.
ioutfn (optional: default=0) -- Function table to write phase and frequency values (optional). The format is the same as in the case of itabl. This table is useful when experimenting with random numbers to record the best values.
The two optional tables (itabl and ioutfn) are accessed only at i-time. This is useful to know, as the tables can be safely overwritten after opcode initialization, which allows precalculating parameters at i-time and storing in a temporary table before oscbnk initialization.
Performance
ares -- Output signal.
kcps -- Oscillator frequency in Hz.
kamd -- AM depth (0 - 1).
If ilfomode is not set to modulate the amplitude, then (AM output) = (AM input) regardless of the value of kamd. That means that kamd will have no effect.
Note: Amplitude modulation is applied before the parametric equalizer.
kfmd -- FM depth (in Hz).
kpmd -- Phase modulation depth.
kl1minf, kl1maxf -- LFO1 minimum and maximum frequency in Hz.
kl2minf, kl2maxf -- LFO2 minimum and maximum frequency in Hz. (Note: oscillator and LFO frequencies are allowed to be zero or negative.)
keqminf, keqmaxf -- Parametric equalizer minimum and maximum frequency in Hz.
keqminl, keqmaxl -- Parametric equalizer minimum and maximum level.
keqminq, keqmaxq -- Parametric equalizer minimum and maximum Q.
kfn -- Oscillator waveform table. Table number can be changed at k-rate (this is useful to select from a set of band-limited tables generated by GEN30, to avoid aliasing). The table is read with linear interpolation.
Note
oscbnk uses the same random number generator as rnd31. So reading its documentation is also recommended.
Examples
Here is an example of oscbnk opcode. It uses the file oscbnk.csd.
Here is an advanced example of oscbnk opcode. It uses the file oscbnk-advanced.csd.
Advanced example of the oscbnk opcode. | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
See also
Credits
Author: Istvan Varga
2001
New in version 4.15
Updated April 2002 by Istvan Varga