vco2ift
Returns a table number at i-time for a given oscillator frequency and waveform.
vco2ift is the same as vco2ft, but works at i-time. It is suitable for use with opcodes that expect an i-rate table number (for example, oscili).
Syntax
Initialization
ifn -- the ftable number.
icps -- frequency in Hz. Zero and negative values are allowed. However, if the absolute value exceeds sr/2 (or sr * inyx), the selected table will contain silence.
iwave -- the waveform for which table number is to be selected. Allowed values are:
- 0: sawtooth
- 1: 4 * x * (1 - x) (integrated sawtooth)
- 2: pulse (not normalized)
- 3: square wave
- 4: triangle
Additionally, negative iwave values select user defined waveforms (see also vco2init).
inyx (optional, default=0.5) -- bandwidth of the generated waveform, as percentage (0 to 1) of the sample rate. The expected range is 0 to 0.5 (i.e. up to sr/2), other values are limited to the allowed range.
Setting inyx to 0.25 (sr/4), or 0.3333 (sr/3) can produce a “fatter” sound in some cases, although it is more likely to reduce quality.
Examples
This example builds a band-limited table set from a user-defined waveform, then uses vco2ift to select a table for each note. It uses the file vco2ift.csd.
The generated tables start after the source table. The frequency passed to vco2ift also drives oscili, so the selected table has the right bandwidth for playback. Because selection happens only at initialization, use vco2ft with an oscillator that accepts a k-rate table number if the frequency changes during a note.
The example prints each note's frequency and selected table number. Higher notes select tables with fewer harmonics. The table numbers depend on the generated set and should not be hard-coded.
See the example for the vco2 opcode too.
See Also
Credits
Author: Istvan Varga
New in version 4.22