| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac ; activate real-time audio |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
; STORE AUDIO IN RAM USING GEN01 FUNCTION TABLE |
| 12 |
giSoundFile ftgen 0, 0, 0, 1, "loop.wav", 0, 0, 0 |
| 13 |
|
| 14 |
instr 1 ; play audio from function table using flooper2 opcode |
| 15 |
kAmp = 1 ; amplitude |
| 16 |
kPitch = p4 ; pitch/speed |
| 17 |
kLoopStart = 0 ; point where looping begins (in seconds) |
| 18 |
kLoopEnd = nsamp(giSoundFile)/sr; loop end (end of file) |
| 19 |
kCrossFade = 0 ; cross-fade time |
| 20 |
; read audio from the function table using the flooper2 opcode |
| 21 |
aSig flooper2 kAmp,kPitch,kLoopStart,kLoopEnd,kCrossFade,giSoundFile |
| 22 |
out aSig, aSig ; send audio to output |
| 23 |
endin |
| 24 |
|
| 25 |
</CsInstruments> |
| 26 |
<CsScore> |
| 27 |
; p4 = pitch |
| 28 |
; (sound file duration is 4.224) |
| 29 |
i 1 0 [4.224*2] 1 |
| 30 |
i 1 + [4.224*2] 0.5 |
| 31 |
i 1 + [4.224*1] 2 |
| 32 |
e |
| 33 |
</CsScore> |
| 34 |
</CsoundSynthesizer> |
| 35 |
; example written by Iain McCurdy |