| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-i adc |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
; -- size for 5 seconds of recording audio data |
| 11 |
giAudio ftgen 0, 0, -5*sr, 2, 0 |
| 12 |
|
| 13 |
instr 1 ;record live input |
| 14 |
ktim timeinsts ; playing time of the instrument in seconds |
| 15 |
prints "PLEASE GIVE YOUR LIVE INPUT AFTER THE BEEP!%n" |
| 16 |
kBeepEnv linseg 0, 1, 0, .01, 1, .5, 1, .01, 0 |
| 17 |
aBeep oscils .2, 600, 0 |
| 18 |
outs aBeep*kBeepEnv, aBeep*kBeepEnv |
| 19 |
;;record the audiosignal after 2 seconds |
| 20 |
if ktim > 2 then |
| 21 |
ain inch 1 |
| 22 |
printks "RECORDING LIVE INPUT!%n", 10 |
| 23 |
;create a writing pointer in the table, |
| 24 |
;moving in 5 seconds from index 0 to the end |
| 25 |
aindx phasor 1/5 |
| 26 |
;write the k-signal |
| 27 |
tablew ain, aindx, giAudio, 1 |
| 28 |
endif |
| 29 |
endin |
| 30 |
|
| 31 |
instr 2; write the giAudio table to a soundfile |
| 32 |
iDone ftaudio giAudio, "testwrite.wav", -1 |
| 33 |
if iDone==1 then |
| 34 |
prints "FUNCTION TABLE WRITTEN TO FILE 'testwrite.wav'!%n" |
| 35 |
endif |
| 36 |
endin |
| 37 |
|
| 38 |
</CsInstruments> |
| 39 |
<CsScore> |
| 40 |
i 1 0 7 |
| 41 |
i 2 7 0 |
| 42 |
</CsScore> |
| 43 |
</CsoundSynthesizer> |
| 44 |
;example by joachim heintz |