Debian Codegraph @

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

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4 </CsOptions>
5 <CsInstruments>
6
7 sr = 44100
8 ksmps = 1
9 nchnls = 1
10 0dbfs = 1
11
12 giWave ftgen 0,0,2^10,10,1,1/2,1/4,1/8,1/16,1/32,1/64
13
14 instr 1 ;grain generating instrument 1
15 kRate = p4
16 kTrig metro kRate ; a trigger to generate grains
17 kDur = p5
18 kForm = p6
19 ;note delay time (p2) is defined using a random function -
20 ;- beginning with no randomization but then gradually increasing
21 kDelayRange transeg 0,1,0,0, p3-1,4,0.03
22 kDelay gauss kDelayRange
23 ; p1 p2 p3 p4
24 ;trigger a note (grain) in instr 3
25 schedkwhen kTrig,0,0,3, abs(kDelay), kDur,kForm
26 endin
27
28 instr 2 ;grain generating instrument 2
29 kRate = p4
30 kTrig metro kRate ; a trigger to generate grains
31 kDur = p5
32 ;formant frequency (p4) is multiplied by a random function -
33 ;- beginning with no randomization but then gradually increasing
34 kForm = p6
35 kFormOSRange transeg 0,1,0,0, p3-1,2,12 ;range defined in semitones
36 kFormOS gauss kFormOSRange
37 ; p1 p2 p3 p4
38 schedkwhen kTrig,0,0,3, 0, kDur,kForm*semitone(kFormOS)
39 endin
40
41 instr 3 ;grain sounding instrument
42 iForm = p4
43 aEnv linseg 0,0.005,0.2,p3-0.01,0.2,0.005,0
44 aSig poscil aEnv, iForm, giWave
45 out aSig
46 endin
47
48 </CsInstruments>
49 <CsScore>
50 ;p4 = rate
51 ;p5 = duration
52 ;p6 = formant
53 ; p1 p2 p3 p4 p5 p6
54 i 1 0 12 200 0.02 400
55 i 2 12.5 12 200 0.02 400
56 e
57 </CsScore>
58 </CsoundSynthesizer>
59 ;example by Iain McCurdy