<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac -d ;;;realtime audio out;-iadc ;;;uncomment -iadc if realtime audio input is needed too; For Non-realtime ouput leave only the line below:; -o centroid.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1Sine@global:i=ftgen(0,0,16384,10,1)instr1trig:k=init(1);calculate centroida1=oscil3(0.5,p4,Sine);of the sine wavek1=centroid(a1,trig,16384)sig:a=oscil3(0.5,k1,Sine)printk2(k1);print & compare:outs(a1,sig);left = original, right = centroid signalendin</CsInstruments><CsScore>i10220i1+2200i1+22000e</CsScore></CsoundSynthesizer>
Here is an example of the centroid opcode. It uses the file centroid.csd.
<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 centroid.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1giSineftgen0,0,16384,10,1instr1ktriginit1;calculate centroida1oscil30.5,p4,giSine;of the sine wavek1centroida1,ktrig,16384asigoscil30.5,k1,giSineprintk2k1;print & compare:outsa1,asig;left = original, right = centroid signalendin</CsInstruments><CsScore>i10220i1+2200i1+22000e</CsScore></CsoundSynthesizer>