Debian Codegraph @

src/Examples/FLOSS Manual Examples/05 Sound Modification/05D08_custom_delay_line.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac ; activates real time sound output
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 2
9 0dbfs = 1
10
11 instr CustomDelayLine
12
13 ;; 0.25 second delay
14 idel_size = 0.25 * sr
15 kdelay_line[] init idel_size
16 kread_ptr init 1
17 kwrite_ptr init 0
18
19 asig = vco2(0.3, 220 * (1 + int(lfo:k(3, 2, 2))) * expon(1, p3, 4), 10)
20 asig = zdf_ladder(asig, 2000, 4)
21
22 kindx = 0
23 while (kindx < ksmps) do
24 kdelay_line[kwrite_ptr] = asig[kindx]
25 adel[kindx] = kdelay_line[kread_ptr]
26
27 kwrite_ptr = (kwrite_ptr + 1) % idel_size
28 kread_ptr = (kread_ptr + 1) % idel_size
29
30 kindx += 1
31 od
32
33 out(linen:a(asig,0,p3,1),linen:a(adel,0,p3,1))
34
35 endin
36
37 </CsInstruments>
38 <CsScore>
39 i "CustomDelayLine" 0 10
40 </CsScore>
41 </CsoundSynthesizer>
42 ;example by Steven Yi