| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in |
| 5 |
-n ; no sound |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o divz.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 |
ka init 200 ; Define the numbers to be divided. |
| 19 |
kb line 0, p3, 200 ; Linearly change the value of kb from 200 to 0. |
| 20 |
ksubst init -1 ; If a "divide by zero" error occurs, substitute -1. |
| 21 |
kresults divz ka, kb, ksubst ; Safely divide the numbers. |
| 22 |
printks "%f / %f = %f\\n", 0.1, ka, kb, kresults ; Print out the results. |
| 23 |
|
| 24 |
endin |
| 25 |
|
| 26 |
</CsInstruments> |
| 27 |
<CsScore> |
| 28 |
i 1 0 .3 |
| 29 |
e |
| 30 |
</CsScore> |
| 31 |
</CsoundSynthesizer> |