Debian Codegraph @

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

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 96000
8 ksmps = 16
9 nchnls = 1
10 0dbfs = 1
11
12 ;waveforms used for granulation
13 giSaw ftgen 1,0,4096,7,0,4096,1
14 giSq ftgen 2,0,4096,7,0,2046,0,0,1,2046,1
15 giTri ftgen 3,0,4096,7,0,2046,1,2046,0
16 giPls ftgen 4,0,4096,7,1,200,1,0,0,4096-200,0
17 giBuzz ftgen 5,0,4096,11,20,1,1
18
19 ;window function - used as an amplitude envelope for each grain
20 ;(hanning window)
21 giWFn ftgen 7,0,16384,20,2,1
22
23 instr 1
24 ;random spline generates formant values in oct format
25 kOct rspline 4,8,0.1,0.5
26 ;oct format values converted to cps format
27 kCPS = cpsoct(kOct)
28 ;phase location is left at 0 (the beginning of the waveform)
29 kPhs = 0
30 ;frequency (formant) randomization and phase randomization are not used
31 kFmd = 0
32 kPmd = 0
33 ;grain duration and density (rate of grain generation)
34 kGDur rspline 0.01,0.2,0.05,0.2
35 kDens rspline 10,200,0.05,0.5
36 ;maximum number of grain overlaps allowed. This is used as a CPU brake
37 iMaxOvr = 1000
38 ;function table for source waveform for content of the grain
39 ;a different waveform chosen once every 10 seconds
40 kFn randomh 1,5.99,0.1
41 ;print info. to the terminal
42 printks "CPS:%5.2F%TDur:%5.2F%TDensity:%5.2F%TWaveform:%1.0F%n",
43 1, kCPS, kGDur, kDens, kFn
44 aSig grain3 kCPS, kPhs, kFmd, kPmd, kGDur, kDens, iMaxOvr, kFn, giWFn, 0, 0
45 out aSig*0.06
46 endin
47
48 </CsInstruments>
49 <CsScore>
50 i 1 0 300
51 e
52 </CsScore>
53 </CsoundSynthesizer>
54 ;example by Iain McCurdy