Debian Codegraph @

src/Examples/FLOSS Manual Examples/04 Sound Synthesis/04D04_Standard.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac -m128
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 32
9 nchnls = 2
10 0dbfs = 1
11
12 instr Standard
13
14 //input
15 iC = 400
16 iR = p4 ;ratio
17 iI = p5 ;index
18 prints "Ratio = %.3f, Index = %.3f\n", iR, iI
19
20 //transform
21 iM = iC / iR
22 iD = iI * iM
23
24 //apply to standard model
25 aModulator poscil iD, iM
26 aCarrier poscil 0.3, iC + aModulator
27 aOut linen aCarrier, .1, p3, 1
28 out aOut, aOut
29
30 endin
31
32 instr PlayMess
33
34 kC randomi 300, 500, 1, 2, 400
35 kR randomi 1, 2, 2, 3
36 kI randomi 1, 5, randomi:k(3,10,1,3), 3
37
38 //transform
39 kM = kC / kR
40 kD = kI * kM
41
42 //apply to standard model
43 aModulator poscil kD, kM
44 aCarrier poscil ampdb(port:k(kI*5-30,.1)), kC + aModulator
45 aOut linen aCarrier, .1, p3, p3/10
46 out aOut, aOut
47
48 endin
49
50 </CsInstruments>
51 <CsScore>
52 //changing the ratio at constant index=3
53 i "Standard" 0 3 1 3
54 i . + . 1.41 .
55 i . + . 1.75 .
56 i . + . 2.07 .
57 s
58 //changing the index at constant ratio=3.3
59 i "Standard" 0 3 3.3 0
60 i . + . . 1
61 i . + . . 5
62 i . + . . 10
63 s
64 //let some nonsense happen
65 i "PlayMess" 0 30
66 </CsScore>
67 </CsoundSynthesizer>
68 ;example by joachim heintz