vco2ift

vco2ift — Returns a table number at i-time for a given oscillator frequency and wavform.

Description

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

ifn vco2ift icps, iwave [, inyx]

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

Here is an example of the vco2ift opcode. It uses the file vco2ift.csd.

Example 1164. Example of the vco2ift 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 vco2ift.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

; user defined waveform -2: fixed table size (64), number of partials
; multiplier is 1.4
itmp    ftgen 2, 0, 64, 5, 1, 2, 120, 60, 1, 1, 0.001, 1
ift     vco2init -2, 3, 1.4, 4096, 4096, 2


instr 1

icps = p4
ifn  vco2ift icps, -2, 0.5	;with user defined waveform
print ifn
asig oscili 1, 220, ifn		; (-2), and sr/2 bandwidth
     outs asig, asig

endin
</CsInstruments>
<CsScore>

i 1 0 2 20
i 1 3 2 2000
i 1 6 2 20000

e
</CsScore>
</CsoundSynthesizer>


Its output should include a line like these:

instr 1:  ifn = 22.000
instr 1:  ifn = 8.000
instr 1:  ifn = 3.000
      

See the example for the vco2 opcode too.

See Also

vco2ft, vco2init, and vco2.

Credits

Author: Istvan Varga

New in version 4.22