poscil

poscil — High precision oscillator.

Description

High precision oscillator.

Syntax

ares poscil aamp, acps [, ifn, iphs]
ares poscil aamp, kcps [, ifn, iphs]
ares poscil kamp, acps [, ifn, iphs]
ares poscil kamp, kcps [, ifn, iphs]
ires poscil kamp, kcps [, ifn, iphs]
kres poscil kamp, kcps [, ifn, iphs]

Initialization

ifn -- (optional) function table number. This defaults to -1 which indicates a sinewave.

iphs (optional, default=0) -- initial phase (normalized table index 0-1). If a negative value is given initialisation of the phase is skipped.

Performance

ares -- output signal

kamp, aamp -- the amplitude of the output signal.

kcps, acps -- the frequency of the output signal in cycles per second.

poscil (precise oscillator) is the same as oscili, but allows much more precise frequency control, especially when using long tables and low frequency values. It uses floating-point table indexing, instead of integer math, like oscil and oscili. It is only a bit slower than oscili.

Since Csound 4.22, poscil can accept also negative frequency values and use a-rate values both for amplitude and frequency. So both AM and FM are allowed using this opcode.

The opcode poscil3 is the same as poscil, but uses cubic interpolation.

Note that poscil can use deffered (non-power of two) length tables.

Examples

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

Example 777. Example of the poscil 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 RT audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o poscil.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

seed 0
gisine ftgen 0, 0, 2^10, 10, 1

instr 1

ipeak random 0, 1 		;where is the envelope peak
asig  poscil .8, 220, gisine
aenv  transeg 0, p3*ipeak, 6, 1, p3-p3*ipeak, -6, 0
aL,aR pan2 asig*aenv, ipeak	;pan according to random value
      outs aL, aR

endin

</CsInstruments>
<CsScore>
i1 0 5
i1 4 5
i1 8 5
e
</CsScore>
</CsoundSynthesizer>


See Also

poscil3

Credits

Author: Gabriel Maldonado
Italy
1998

November 2002. Added a note about the changes to Csound version 4.22, thanks to Rasmus Ekman.

New in Csound version 3.52

Function table optional in Csound version 6.00

Skip of initialisation new in version 6.06