vco2ft

vco2ft — Returns a table number at k-time for a given oscillator frequency and wavform.

Description

vco2ft returns the function table number to be used for generating the specified waveform at a given frequency. This function table number can be used by any Csound opcode that generates a signal by reading function tables (like oscilikt). The tables must be calculated by vco2init before vco2ft is called and shared as Csound ftables (ibasfn).

Syntax

kfn vco2ft kcps, iwave [, inyx]

Initialization

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.

Performance

kfn -- the ftable number, returned at k-rate.

kcps -- frequency in Hz, returned at k-rate. Zero and negative values are allowed. However, if the absolute value exceeds sr/2 (or sr * inyx), the selected table will contain silence.

Examples

See the example for the vco2 opcode.

See Also

vco2ift, vco2init, and vco2.

Credits

Author: Istvan Varga

New in version 4.22