Transfers control on every pass when the condition is not true.
Syntax
cngoto(condition,label)
cngotocondition,label
where label is in the same instrument block and is not an expression, and where condition uses one of the Relational operators (<, =, <=, ==, !=) (and = for convenience, see also under Conditional Values).
Examples
Here is an example of the cngoto opcode. It uses the file cngoto-modern.csd.
<CsoundSynthesizer><CsOptions>; Audio out Audio in-odac
-d
; -iadc ;;;RT audio I/O; -o cngoto.wav -W ;;; for file output any platform</CsOptions><CsInstruments>; Initialize the global variables.sr=44100ksmps=10nchnls=1; Instrument #1.instr1; Change kval linearly from 0 to 2 over; the period set by the third p-field.val:k=line(0,p3,2); If kval *is not* greater than or equal to 1 then play; the high note. Otherwise, play the low note.cngoto(val>=1,highnote)kgoto(lownote)highnote:freq:k=880goto(playit)lownote:freq=440playit:; Print the values of kval and kfreq.printks("val = %f, freq = %f\\n",1,val,freq)out(poscil(10000,freq))endin</CsInstruments><CsScore>; Play Instrument #1 for two seconds.i102e</CsScore></CsoundSynthesizer>
Here is an example of the cngoto opcode. It uses the file cngoto.csd.
<CsoundSynthesizer><CsOptions>; Audio out Audio in-odac -iadc ;;;RT audio I/O; -o cngoto.wav -W ;;; for file output any platform</CsOptions><CsInstruments>; Initialize the global variables.sr=44100ksmps=10nchnls=1; Instrument #1.instr1; Change kval linearly from 0 to 2 over; the period set by the third p-field.kvalline0,p3,2; If kval *is not* greater than or equal to 1 then play; the high note. Otherwise, play the low note.cngoto(kval>=1),highnotekgotolownotehighnote:kfreq=880gotoplayitlownote:kfreq=440gotoplayitplayit:; Print the values of kval and kfreq.printks"kval = %f, kfreq = %f\\n",1,kval,kfreqa1oscil10000,kfreq,1outa1endin</CsInstruments><CsScore>; Table: a simple sine wave.f1032768101; Play Instrument #1 for two seconds.i102e</CsScore></CsoundSynthesizer>