| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
instr Grain |
| 12 |
//input parameters |
| 13 |
Sound = "fox.wav" |
| 14 |
iStart = p4 ;position in sec to read the sound |
| 15 |
iSpeed = 1 |
| 16 |
iVolume = -3 ;dB |
| 17 |
iPan = .5 ;0=left, 1=right |
| 18 |
//perform |
| 19 |
aSound = diskin:a(Sound,iSpeed,iStart,1) |
| 20 |
aOut = linen:a(aSound,p3/2,p3,p3/2) |
| 21 |
aL, aR pan2 aOut*ampdb(iVolume), iPan |
| 22 |
out(aL,aR) |
| 23 |
//call next grain until sound file has reached its end |
| 24 |
if iStart < filelen(Sound) then |
| 25 |
schedule("Grain",p3,p3,iStart+p3) |
| 26 |
endif |
| 27 |
endin |
| 28 |
schedule("Grain",0,50/1000,0) |
| 29 |
|
| 30 |
</CsInstruments> |
| 31 |
<CsScore> |
| 32 |
e 5 ;stops performance after 5 seconds |
| 33 |
</CsScore> |
| 34 |
</CsoundSynthesizer> |
| 35 |
;example by joachim heintz |