<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac -d ;;;RT audio out;-iadc ;;;uncomment -iadc if RT audio input is needed too; For Non-realtime ouput leave only the line below:; -o cent.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1instr1; original pitchroot:i=440; root note = A (440 Hz)print(root);print outsig:a=oscili(0.6,root,1)outs(sig,sig)endininstr2root:i=440; root note = A (440 Hz)cents:i=p4; change root note by 300 and 1200 centsfactor:i=cent(cents); calculate new notenew:i=root*factorprint(root); Print allprint(factor)print(new)sig:a=oscili(0.6,new,1)outs(sig,sig)endin</CsInstruments><CsScore>; sine wavef1032768101i102;no changei22.52300;note = C above Ai2521200;1 octave higher e</CsScore></CsoundSynthesizer>
Here is an example of the cent opcode. It uses the file cent.csd.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac ;;;RT audio out;-iadc ;;;uncomment -iadc if RT audio input is needed too; For Non-realtime ouput leave only the line below:; -o cent.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1instr1; original pitchiroot=440; root note = A (440 Hz)printiroot;print outasigoscili0.6,iroot,1outsasig,asigendininstr2iroot=440; root note = A (440 Hz)icents=p4; change root note by 300 and 1200 centsifactor=cent(icents); calculate new noteinew=iroot*ifactorprintiroot; Print allprintifactorprintinewasigoscili0.6,inew,1outsasig,asigendin</CsInstruments><CsScore>; sine wavef1032768101i102;no changei22.52300;note = C above Ai2521200;1 octave higher e</CsScore></CsoundSynthesizer>