Debian Codegraph @

src/Examples/McCurdy Haikus/8.csd

raw
1 ; Csound Haiku VIII
2 ; Iain McCurdy 2011
3 ; small code modifcations by joachim heintz 2024
4
5 <CsoundSynthesizer>
6 <CsOptions>
7 -odac -dm0
8 </CsOptions>
9 <CsInstruments>
10 sr = 44100
11 ksmps = 32
12 nchnls = 2
13 0dbfs = 1
14 seed 0
15
16 gigaps = ftgen(0, 0, 100, -17, 0,32, 5,2, 45,1/2, 70,1/8, 90,2/9)
17 gidurs = ftgen(0, 0, 100, -17, 0,0.4, 85,4)
18 giwave = ftgen(0, 0, 131072, 10, 1, 0, 0, 0, 0.05)
19 gisine = ftgen(0, 0, 4096, 10, 1)
20 gasendL init 0
21 gasendR init 0
22
23 instr start_layers
24 indx = 0
25 while (indx < 3) do
26 schedule("layer",0,3600*24*7)
27 indx += 1
28 od
29 endin
30 schedule("start_layers",0,0)
31
32 instr layer
33 kndx = randomh:k(0,1,1,3)
34 kgap = table:k(kndx,gigaps,1)
35 knote = randomh:k(0,12,0.1,3)
36 kamp = rspline:k(0,0.1,1,2)
37 kpan = rspline:k(0.1,0.9,0.1,1)
38 kmul = rspline:k(0.1,0.9,0.1,0.3)
39 schedkwhen(metro(1/kgap),0,0,"note",rnd:k(0.1),0.01,int(knote)*3,kamp,kpan,kmul)
40 endin
41
42 instr note
43 iratio = int(rnd:i(20))+1
44 p3 = table:i(rnd:i(1),gidurs,1)
45 aenv = expseg:a(1,p3,0.001)
46 aperc = expseg:a(5,0.001,1,1,1)
47 if (random:i(0,1) <= 0.1) then
48 abend = linseg:a(1,p3,semitone(random:i(-8,4)))
49 aperc *= abend
50 endif
51 kmul = expon:k(abs(p7),p3,0.0001)
52 a1 = gbuzz(p5*aenv,mtof:i(p4)*iratio*aperc,int(rnd(500))+1,rnd(12)+1,kmul,giwave)
53 if (random:i(0,1) <= 0.2) && (p3 > 1) then
54 kfshift = transeg:k(0,p3,-15,rnd(200)-100)
55 ar,ai hilbert a1
56 asin = oscili:a(1,kfshift,gisine,0)
57 acos = oscili:a(1,kfshift,gisine,0.25)
58 amod1 = ar*acos
59 amod2 = ai*asin
60 a1 = ((amod1-amod2)/3)+a1
61 endif
62 a1 = butlp(a1,cpsoct(rnd(8)+4))
63 a1,a2 pan2 a1,p6
64 a1 = delay(a1,rnd(0.03)+0.001)
65 a2 = delay(a2,rnd(0.03)+0.001)
66 out(a1,a2)
67 gasendL += a1*0.3
68 gasendR += a2*0.3
69 endin
70
71 instr reverb
72 aL,aR reverbsc gasendL,gasendR,0.75,10000
73 out(aL,aR)
74 clear(gasendL,gasendR)
75 endin
76 schedule("reverb",0,-1)
77
78 </CsInstruments>
79
80 <CsScore>
81 </CsScore>
82
83
84 </CsoundSynthesizer>
85
86
87
88
89
90
91
92
93 <bsbPanel>
94 <label>Widgets</label>
95 <objectName/>
96 <x>100</x>
97 <y>100</y>
98 <width>320</width>
99 <height>240</height>
100 <visible>true</visible>
101 <uuid/>
102 <bgcolor mode="background">
103 <r>240</r>
104 <g>240</g>
105 <b>240</b>
106 </bgcolor>
107 </bsbPanel>
108 <bsbPresets>
109 </bsbPresets>