High precision oscillator with cubic interpolation.
poscil3 (precise oscillator) is the same as oscil3, but
always employs floating-point table indexing, instead of integer math. It is only a bit slower than oscil3 when reading power-two size tables.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac;;;realtime audio out;-iadc ;;;uncomment -iadc if real audio input is needed too; For Non-realtime ouput leave only the line below:; -o poscil3.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1giSineftgen0,0,2^10,10,1instr1krndrandomh40,440,1; produce random valuesainposcil3.6,krnd,giSineklineline1,p3,0; straight lineaL,aRpan2ain,kline; sent across imageoutsaL,aRendin</CsInstruments><CsScore>i1010e</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.
<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/2008sr=44100kr=4410ksmps=10nchnls=1; non-normalized function table with a sample 1giFileftgen1,0,0,-1,"fox.wav",0,0,0; Instrument #1 - uses poscil3 for playing samples from a function tableinstr1kamp=p4kspeed=p5ifn=1iskip=p6kcps=kspeed/(ftlen(ifn)/ftsr(ifn)); frequency of the oscillatoriphs=iskip/(ftlen(ifn)/ftsr(ifn)); calculates skiptime to phase values (0-1)a1poscil3kamp,kcps,ifn,iphsouta1endin</CsInstruments><CsScore>i102.756110i132.7561-10i161.3781.52.067e</CsScore></CsoundSynthesizer>