| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
-o dac |
| 4 |
</CsOptions> |
| 5 |
<CsInstruments> |
| 6 |
sr = 44100 |
| 7 |
ksmps = 32 |
| 8 |
nchnls = 2 |
| 9 |
0dbfs = 1 |
| 10 |
|
| 11 |
instr 1; send i-values |
| 12 |
chnset 1, "sio" |
| 13 |
chnset -1, "non" |
| 14 |
endin |
| 15 |
|
| 16 |
instr 2; send k-values |
| 17 |
kfreq randomi 100, 300, 1 |
| 18 |
chnset kfreq, "cntrfreq" |
| 19 |
kbw = kfreq/10 |
| 20 |
chnset kbw, "bandw" |
| 21 |
endin |
| 22 |
|
| 23 |
instr 3; send a-values |
| 24 |
anois rand .1 |
| 25 |
chnset anois, "noise" |
| 26 |
loop: |
| 27 |
idur random .3, 1.5 |
| 28 |
timout 0, idur, do |
| 29 |
reinit loop |
| 30 |
do: |
| 31 |
ifreq random 400, 1200 |
| 32 |
iamp random .1, .3 |
| 33 |
asig oscils iamp, ifreq, 0 |
| 34 |
aenv transeg 1, idur, -10, 0 |
| 35 |
asine = asig * aenv |
| 36 |
chnset asine, "sine" |
| 37 |
endin |
| 38 |
|
| 39 |
instr 11; receive some chn values and send again |
| 40 |
ival1 chnget "sio" |
| 41 |
ival2 chnget "non" |
| 42 |
print ival1, ival2 |
| 43 |
kcntfreq chnget "cntrfreq" |
| 44 |
kbandw chnget "bandw" |
| 45 |
anoise chnget "noise" |
| 46 |
afilt reson anoise, kcntfreq, kbandw |
| 47 |
afilt balance afilt, anoise |
| 48 |
chnset afilt, "filtered" |
| 49 |
endin |
| 50 |
|
| 51 |
instr 12; mix the two audio signals |
| 52 |
amix1 chnget "sine" |
| 53 |
amix2 chnget "filtered" |
| 54 |
chnmix amix1, "mix" |
| 55 |
chnmix amix2, "mix" |
| 56 |
endin |
| 57 |
|
| 58 |
instr 20; receive and reverb |
| 59 |
amix chnget "mix" |
| 60 |
aL, aR freeverb amix, amix, .8, .5 |
| 61 |
outs aL, aR |
| 62 |
endin |
| 63 |
|
| 64 |
instr 100; clear |
| 65 |
chnclear "mix" |
| 66 |
endin |
| 67 |
|
| 68 |
</CsInstruments> |
| 69 |
<CsScore> |
| 70 |
i 1 0 20 |
| 71 |
i 2 0 20 |
| 72 |
i 3 0 20 |
| 73 |
i 11 0 20 |
| 74 |
i 12 0 20 |
| 75 |
i 20 0 20 |
| 76 |
i 100 0 20 |
| 77 |
</CsScore> |
| 78 |
</CsoundSynthesizer> |
| 79 |
;example by joachim heintz |