Debian Codegraph @

src/Examples/FLOSS Manual Examples/03 Csound Language/03F03_Score_tricks.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 2
9 0dbfs = 1
10
11 giWav ftgen 0, 0, 2^10, 10, 1, .5, .3, .1
12
13 instr 1
14 kFadout init 1
15 krel release ;returns "1" if last k-cycle
16 if krel == 1 && p3 < 0 then ;if so, and negative p3:
17 xtratim .5 ;give 0.5 extra seconds
18 kFadout linseg 1, .5, 0 ;and make fade out
19 endif
20 kEnv linseg 0, .01, p4, abs(p3)-.1, p4, .09, 0; normal fade out
21 aSig poscil kEnv*kFadout, p5, giWav
22 outs aSig, aSig
23 endin
24
25 </CsInstruments>
26 <CsScore>
27 t 0 120 ;set tempo to 120 beats per minute
28 i 1 0 1 .2 400 ;play instr 1 for one second
29 i 1 2 -10 .5 500 ;play instr 1 indefinetely (negative p3)
30 i -1 5 0 ;turn it off (negative p1)
31 ; -- turn on instance 1 of instr 1 one sec after the previous start
32 i 1.1 ^+1 -10 .2 600
33 i 1.2 ^+2 -10 .2 700 ;another instance of instr 1
34 i -1.2 ^+2 0 ;turn off 1.2
35 ; -- turn off 1.1 (dot = same as the same p-field above)
36 i -1.1 ^+1 .
37 s ;end of a section, so time again starts at zero
38 i 1 1 1 .2 800
39 r 5 ;repeats the following line (until the next "s")
40 i 1 .25 .25 .2 900
41 s
42 v 2 ;lets time be double as long
43 i 1 0 2 .2 1000
44 i 1 1 1 .2 1100
45 s
46 v 0.5 ;lets time be half as long
47 i 1 0 2 .2 1200
48 i 1 1 1 .2 1300
49 s ;time is normal now again
50 i 1 0 2 .2 1000
51 i 1 1 1 .2 900
52 s
53 ; -- make a score loop (4 times) with the variable "LOOP"
54 {4 LOOP
55 i 1 [0 + 4 * $LOOP.] 3 .2 [1200 - $LOOP. * 100]
56 i 1 [1 + 4 * $LOOP.] 2 . [1200 - $LOOP. * 200]
57 i 1 [2 + 4 * $LOOP.] 1 . [1200 - $LOOP. * 300]
58 }
59 e
60 </CsScore>
61 </CsoundSynthesizer>
62 ;example by joachim heintz