poscil3 — High precision oscillator with cubic interpolation.
ifn -- function table number
iphs (optional, default=0) -- initial phase (normalized table index 0-1)
ares -- output signal
kamp -- the amplitude of the output signal.
kcps -- the frequency of the output signal in cycles per second.
poscil3 works like poscil, but uses cubic interpolation.
Note that poscil3 can use deffered (non-power of two) length tables.
Here is an example of the poscil3 opcode. It uses the file poscil3.csd.
Example 437. Example of the poscil3 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 ; Audio out Audio in No messages -odac -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o poscil3.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> ; 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 poscil3 kamp, kcps, ifn out a1 endin </CsInstruments> <CsScore> ; Table #1, a sine wave. f 1 0 16384 10 1 ; Play Instrument #1 for 2 seconds. i 1 0 2 e </CsScore> </CsoundSynthesizer>
Here is another example of the poscil3 opcode, which uses a table filled from a sound file. It uses the file poscil3-file.csd.
Example 438. Another example of the poscil3 opcode.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in No messages -odac -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o poscil3-file.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> ; Example written by Joachim Heintz 07/2008 sr = 44100 kr = 4410 ksmps = 10 nchnls = 1 ; non-normalized function table with a sample 1 giFile ftgen 1, 0, 0, -1, "fox.wav", 0, 0, 0 ; Instrument #1 - uses poscil3 for playing samples from a function table instr 1 kamp = p4 kspeed = p5 ifn = 1 iskip = p6 kcps = kspeed / (ftlen(ifn) / ftsr(ifn)); frequency of the oscillator iphs = iskip / (ftlen(ifn) / ftsr(ifn)); calculates skiptime to phase values (0-1) a1 poscil3 kamp, kcps, ifn, iphs out a1 endin </CsInstruments> <CsScore> i1 0 2.756 1 1 0 i1 3 2.756 1 -1 0 i1 6 1.378 1 .5 2.067 e </CsScore> </CsoundSynthesizer>