Debian Codegraph @

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

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac
4 </CsOptions>
5 <CsInstruments>
6 sr = 44100
7 ksmps = 32
8 nchnls = 2
9 0dbfs = 1
10
11 //load sample to table and create triangular shape
12 giSample ftgen 0, 0, 0, -1, "fox.wav", 0, 0, 1
13 giEnv ftgen 0, 0, 8192, 20, 3, 1
14 giSampleLen = ftlen(giSample)/sr
15
16 instr Grain
17 //input parameters
18 iStart = p4 ;position in sec to read the sound
19 iSpeed = p5
20 iVolume = -3 ;dB
21 iPan = .5 ;0=left, 1=right
22 //perform
23 aEnv = poscil3:a(ampdb(iVolume),1/p3,giEnv)
24 aSound = poscil3:a(aEnv,iSpeed/giSampleLen,giSample,iStart/giSampleLen)
25 aL, aR pan2 aSound, iPan
26 out(aL,aR)
27 endin
28
29 </CsInstruments>
30 <CsScore>
31 ; start speed
32 i "Grain" 0 .05 .05 1
33 i . 1 . .2 .
34 i . 2 . .42 .
35 i . 3 . .78 .
36 i . 4 . 1.2 .
37 i . 6 . .2 1
38 i . 7 . . 2
39 i . 8 . . 0.5
40 i . 9 . . 10
41 i . 10 . .25 -1
42 </CsScore>
43 </CsoundSynthesizer>
44 ;example by joachim heintz