| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-iadc -odac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
; -- size for 5 seconds of recording control data |
| 12 |
giControl ftgen 0, 0, -5*kr, 2, 0 |
| 13 |
; -- size for 5 seconds of recording audio data |
| 14 |
giAudio ftgen 0, 0, -5*sr, 2, 0 |
| 15 |
giWave ftgen 0, 0, 2^10, 10, 1, .5, .3, .1; waveform for oscillator |
| 16 |
seed 0 |
| 17 |
|
| 18 |
; -- ;recording of a random frequency movement for 5 seconds, and playing it |
| 19 |
instr 1 |
| 20 |
kFreq randomi 400, 1000, 1; random frequency |
| 21 |
aSnd poscil .2, kFreq, giWave; play it |
| 22 |
outs aSnd, aSnd |
| 23 |
;;record the k-signal with a phasor as index |
| 24 |
prints "RECORDING RANDOM CONTROL SIGNAL!%n" |
| 25 |
;create a writing pointer in the table, |
| 26 |
;moving in 5 seconds from index 0 to the end |
| 27 |
kindx phasor 1/5 |
| 28 |
;write the k-signal |
| 29 |
tablew kFreq, kindx, giControl, 1 |
| 30 |
endin |
| 31 |
|
| 32 |
instr 2; read the values of the table and play it with poscil |
| 33 |
prints "PLAYING CONTROL SIGNAL!%n" |
| 34 |
kFreq poscil 1, 1/5, giControl |
| 35 |
aSnd poscil .2, kFreq, giWave; play it |
| 36 |
outs aSnd, aSnd |
| 37 |
endin |
| 38 |
|
| 39 |
instr 3; record live input |
| 40 |
ktim timeinsts ; playing time of the instrument in seconds |
| 41 |
prints "PLEASE GIVE YOUR LIVE INPUT AFTER THE BEEP!%n" |
| 42 |
kBeepEnv linseg 0, 1, 0, .01, 1, .5, 1, .01, 0 |
| 43 |
aBeep oscils .2, 600, 0 |
| 44 |
outs aBeep*kBeepEnv, aBeep*kBeepEnv |
| 45 |
;;record the audiosignal after 2 seconds |
| 46 |
if ktim > 2 then |
| 47 |
ain inch 1 |
| 48 |
printks "RECORDING LIVE INPUT!%n", 10 |
| 49 |
;create a writing pointer in the table, |
| 50 |
;moving in 5 seconds from index 0 to the end |
| 51 |
aindx phasor 1/5 |
| 52 |
;write the k-signal |
| 53 |
tablew ain, aindx, giAudio, 1 |
| 54 |
endif |
| 55 |
endin |
| 56 |
|
| 57 |
instr 4; read the values from the table and play it with poscil |
| 58 |
prints "PLAYING LIVE INPUT!%n" |
| 59 |
aSnd poscil .5, 1/5, giAudio |
| 60 |
outs aSnd, aSnd |
| 61 |
endin |
| 62 |
|
| 63 |
</CsInstruments> |
| 64 |
<CsScore> |
| 65 |
i 1 0 5 |
| 66 |
i 2 6 5 |
| 67 |
i 3 12 7 |
| 68 |
i 4 20 5 |
| 69 |
</CsScore> |
| 70 |
</CsoundSynthesizer> |
| 71 |
;example by joachim heintz |