Debian Codegraph @

src/Examples/FLOSS Manual Examples/01 Basics/01D01_different_seed.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac -m0
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 2
9 0dbfs = 1
10
11 instr generate
12 ;get seed: 0 = seeding from system clock
13 ; otherwise = fixed seed
14 seed p4
15 ;generate four notes to be played from subinstrument
16 iNoteCount = 0
17 while iNoteCount < 4 do
18 iFreq random 400, 800
19 schedule "play", iNoteCount, 2, iFreq
20 iNoteCount += 1 ;increase note count
21 od
22 endin
23
24 instr play
25 iFreq = p4
26 print iFreq
27 aImp mpulse .5, p3
28 aMode mode aImp, iFreq, 1000
29 aEnv linen aMode, 0.01, p3, p3-0.01
30 outs aEnv, aEnv
31 endin
32 </CsInstruments>
33 <CsScore>
34 ;repeat three times with fixed seed
35 r 3
36 i "generate" 0 2 1
37 ;repeat three times with seed from the system clock
38 r 3
39 i "generate" 0 1 0
40 </CsScore>
41 </CsoundSynthesizer>
42 ;example by joachim heintz