| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-n |
| 5 |
</CsOptions> |
| 6 |
<CsInstruments> |
| 7 |
ksmps = 32 |
| 8 |
;example by joachim heintz |
| 9 |
|
| 10 |
seed 0 |
| 11 |
|
| 12 |
instr 1 |
| 13 |
;create an array with 10 elements |
| 14 |
kArr[] init 10 |
| 15 |
;fill in random numbers and print them out |
| 16 |
kIndx = 0 |
| 17 |
until kIndx == 10 do |
| 18 |
kNum random -100, 100 |
| 19 |
kArr[kIndx] = kNum |
| 20 |
printf "kArr[%d] = %10f\n", kIndx+1, kIndx, kNum |
| 21 |
kIndx += 1 |
| 22 |
od |
| 23 |
;investigate maximum number and print it out |
| 24 |
kMax, kMaxIndx maxarray kArr |
| 25 |
printf "Maximum of kArr = %f at index %d\n", kIndx+1, kMax, kMaxIndx |
| 26 |
turnoff |
| 27 |
endin |
| 28 |
|
| 29 |
|
| 30 |
</CsInstruments> |
| 31 |
<CsScore> |
| 32 |
i1 0 0.1 |
| 33 |
e |
| 34 |
</CsScore> |
| 35 |
</CsoundSynthesizer> |