/* Getting started.. Control structures
Let's add tones, the same way, as we've put T-Shirts into the bag!
*/
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
seed 0; makes the random choice each time different
instr 100 ; Oscillator
irand random 0, p4
kEnv madsr 0.1, 0.1, 0.9, 0.1
a1 oscils 0.1, 440*(2^(irand/12)), 0 ; Sine-Osc, producing random freqs between 440 and 1760 hz
outs a1*kEnv, a1*kEnv
endin
; The "if" method..
instr 1
iIndex = 0 ; index
iLimit = p4
loop1: ; label
event_i "i",100, 0, 1, iLimit ; this generates a scoreline from the instrument..
prints "Instance of instr 100 by loop1_%d created!%n", iIndex+1
iIndex = iIndex+1
if (iIndex < 5) igoto loop1
endin
; Using loop_lt..
instr 2
iIndex = 0 ; index
iLimit = p4
loop2: ; label
event_i "i",100, 0, 1, iLimit ; this generates a scoreline from the instrument..
prints "Instance of instr 100 by loop2_%d created!%n", iIndex+1
loop_lt iIndex, 1, 5, loop2
endin
i 1 0 2 24
i 2 3 2 24
i 2 5 2 12
i 2 7 2 2
e
; written by Alex Hofmann (Mar. 2010) - Incontri HMT-Hannover
1013279563397true2552552552426350150{bd0a0ae1-2149-4248-82ce-26a3860e190b}true0-3-255.00000000scope2.000000001.000000001.000000001.000000000.00000000