where the argument within the parentheses may be an expression. Value converters perform arithmetic translation from units of one kind to units of another. The result can then be a term in a further expression.
Examples
Here is an example of the floor opcode. It uses the file floor.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 floor.wav -W ;;; for file output any platform</CsOptions><CsInstruments>sr=44100ksmps=32nchnls=20dbfs=1instr1idivinit1loop:inumber=9i1=inumber/idivifl=floor(i1)printinumber,idiv,ifl;print number / idiv = result using flooridiv=idiv+1if(idiv<=10)igotoloopendin</CsInstruments><CsScore>i100e</CsScore></CsoundSynthesizer>
<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 floor.wav -W ;;; for file output any platform; By Stefano Cucchi 2024</CsOptions><CsInstruments>sr=44100ksmps=320dbfs=1nchnls=2instr1gkrandomrandomh1,45,300,2,3; generate some random numbersgkrandomFLOOR=floor(gkrandom); take the integer partgkrandomFRAC=frac(gkrandom); take the fractional partendininstr10ktriggermetro4kmintim=0kmaxnum=10kinsnum=20kwhen=0kdur=ktrigger*0.25schedkwhenktrigger,kmintim,kmaxnum,kinsnum,kwhen,kdurendininstr20irandomFLOOR=i(gkrandomFLOOR)irandomFRAC=i(gkrandomFRAC); Use the integer part to control the number of harmonics of every note; after converting (k) value to (i)prints"generated value = %f\n",i(gkrandom)prints"--> floor value = %d\n",irandomFLOORa1buzz0.5,120,irandomFLOOR,1kenvelopelinseg0,p3*0.1,1,p3*0.8,1,p3*0.1,0a1=a1*kenvelopeaL,aRpan2a1,irandomFRAC,1; use the fractional part to control the pan position outsaL,aRendin</CsInstruments><CsScore>f1016384101i1010i10010e</CsScore></CsoundSynthesizer>
Here is an example for the rounding-group, comparing the different rounding opcodes. It uses the file rounding-group-modern.csd.