| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-odac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
giFt ftgen 0, 0, -5*kr, 2, 0; size for 5 seconds of recording |
| 12 |
giWave ftgen 0, 0, 2^10, 10, 1, .5, .3, .1; waveform for oscillator |
| 13 |
seed 0 |
| 14 |
|
| 15 |
; - recording of a random frequency movement for 5 seconds, and playing it |
| 16 |
instr 1 |
| 17 |
kFreq randomi 400, 1000, 1 ;random frequency |
| 18 |
aSnd poscil .2, kFreq, giWave ;play it |
| 19 |
outs aSnd, aSnd |
| 20 |
;;record the k-signal |
| 21 |
prints "RECORDING!%n" |
| 22 |
;create a writing pointer in the table, |
| 23 |
;moving in 5 seconds from index 0 to the end |
| 24 |
kindx linseg 0, 5, ftlen(giFt) |
| 25 |
;write the k-signal |
| 26 |
tablew kFreq, kindx, giFt |
| 27 |
endin |
| 28 |
|
| 29 |
instr 2; read the values of the table and play it again |
| 30 |
;;read the k-signal |
| 31 |
prints "PLAYING!%n" |
| 32 |
;create a reading pointer in the table, |
| 33 |
;moving in 5 seconds from index 0 to the end |
| 34 |
kindx linseg 0, 5, ftlen(giFt) |
| 35 |
;read the k-signal |
| 36 |
kFreq table kindx, giFt |
| 37 |
aSnd oscil3 .2, kFreq, giWave; play it |
| 38 |
outs aSnd, aSnd |
| 39 |
endin |
| 40 |
|
| 41 |
</CsInstruments> |
| 42 |
<CsScore> |
| 43 |
i 1 0 5 |
| 44 |
i 2 6 5 |
| 45 |
</CsScore> |
| 46 |
</CsoundSynthesizer> |
| 47 |
;example by joachim heintz |