Debian Codegraph @

examples/gen12.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac ;;;realtime audio out
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o gen12.wav -W ;;; for file output any platform
8 </CsOptions>
9 <CsInstruments>
10 ;example from the Csound Book, page 87
11 sr = 44100
12 ksmps = 32
13 nchnls = 2
14 0dbfs = 1
15
16 instr 1
17
18 idur = p3
19 iamp = p4
20 icarfrq = p5
21 imodfrq = p6
22 aenv expseg .01, idur*.1, iamp, idur*.8, iamp*.75, idur*.1, .01
23 i1 = p7*imodfrq ;p7=modulation index start
24 i2 = p8*imodfrq ;p8=modulation index end
25 adev line i1, idur, i2 ;modulation frequency
26 aindex line p7, idur, p8 ;modulation index
27
28 ar linseg 1, .1, p9, p3-.2, p10, .1, 1 ; r value envelope: p9-p10 =exp. partial strength parameter start and end
29 amp1 = (aindex*(ar+(1/ar)))/2
30 afmod oscili amp1, imodfrq, 1 ;FM modulator (sine)
31 atab = (aindex*(ar-(1/ar)))/2 ;index to table
32 alook tablei atab, 37 ;table lookup to GEN12
33 aamod oscili atab, adev, 2 ;am modulator (cosine)
34 aamod = (exp(alook+aamod))*aenv
35 acar oscili aamod, afmod+icarfrq, 1 ;AFM (carrier)
36 asig balance acar, aenv
37 outs asig, asig
38
39 endin
40
41 </CsInstruments>
42 <CsScore>
43 f 1 0 8192 10 1
44 f 2 0 8192 9 1 1 90
45 f37 0 1024 -12 40 ;Bessel function-defined from 0 to 40
46
47 i 1 0 2 .2 800 800 1 6 .1 2
48 i 1 + . . 1900 147 8 1 4 .2
49 i 1 . . . 1100 380 2 9 .5 2
50 i 1 . 10 . 100 100 11 3 .2 5
51 s
52 i 1 0 1 .1 200 100 1 6 .1 2
53 i 1 + . < < < < < < <
54 i 1 + . . < < < < < <
55 i 1 + . . < < < < < <
56 i 1 + . . < < < < < <
57 i 1 + . . < < < < < <
58 i 1 + . . < < < < < <
59 i 1 + 10 .2 800 800 9 1 .9 6
60 s
61 i 1 0 11 .25 50 51 1 6 .1 2
62 i 1 1 9 .05 700 401 1 6 .1 2
63 i 1 2 8 . 900 147 8 1 4 .2
64 i 1 3 7 . 1100 381 2 9 .5 2
65 i 1 4 6 . 200 102 11 3 .2 5
66 i 1 5 6 . 800 803 9 1 .9 6
67 e
68 </CsScore>
69 </CsoundSynthesizer>
70