| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;realtime audio out |
| 5 |
;-iadc ;;;uncomment -iadc if realtime audio input is needed too |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o <=.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 32 |
| 13 |
nchnls = 2 |
| 14 |
0dbfs = 1 |
| 15 |
|
| 16 |
instr 1 |
| 17 |
|
| 18 |
kval randomh 0, 1.2, 20 ;choose between 0 and 1.2 |
| 19 |
|
| 20 |
if kval >0 && kval<=.5 then ;3 possible outcomes |
| 21 |
kvl = 1 |
| 22 |
elseif kval >.5 && kval<=1 then |
| 23 |
kvl =2 |
| 24 |
elseif kval >1 then |
| 25 |
kvl =3 |
| 26 |
endif |
| 27 |
|
| 28 |
printks "random number = %f, result = %f\n", .1, kval, kvl |
| 29 |
asig poscil .7, 440*kvl, 1 |
| 30 |
outs asig, asig |
| 31 |
|
| 32 |
endin |
| 33 |
</CsInstruments> |
| 34 |
<CsScore> |
| 35 |
f1 0 16384 10 1 |
| 36 |
|
| 37 |
i 1 0 5 |
| 38 |
e |
| 39 |
</CsScore> |
| 40 |
</CsoundSynthesizer> |
| 41 |
|