ar poscil aamp, acps, ifn [, iphs]
ar poscil aamp, kcps, ifn [, iphs]
ar poscil kamp, acps, ifn [, iphs]
ar poscil kamp, kcps, ifn [, iphs]
ir poscil kamp, kcps, ifn [, iphs]
kr poscil kamp, kcps, ifn [, iphs]
ifn -- function table number
iphs (optional, default=0) -- initial phase (in samples)
ar -- 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.
Here is an example of the poscil opcode. It uses the files poscil.orc and poscil.sco.
Example 1. Example of the poscil opcode.
/* poscil.orc */
/* Written by Kevin Conder */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
; Instrument #1 - a basic oscillator.
instr 1
kamp = 10000
kcps = 440
ifn = 1
a1 poscil kamp, kcps, ifn
out a1
endin
/* poscil.orc */
/* poscil.sco */
/* Written by Kevin Conder */
; Table #1, a sine wave.
f 1 0 16384 10 1
; Play Instrument #1 for 2 seconds.
i 1 0 2
e
/* poscil.sco */