| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out Audio in |
| 5 |
-odac -iadc ;;;RT audio I/O |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o active.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
; Initialize the global variables. |
| 12 |
sr = 44100 |
| 13 |
kr = 4410 |
| 14 |
ksmps = 10 |
| 15 |
nchnls = 1 |
| 16 |
|
| 17 |
; Instrument #1 - a noisy waveform. |
| 18 |
instr 1 |
| 19 |
; Generate a really noisy waveform. |
| 20 |
anoisy rand 44100 |
| 21 |
; Turn down its amplitude. |
| 22 |
aoutput gain anoisy, 2500 |
| 23 |
; Send it to the output. |
| 24 |
out aoutput |
| 25 |
endin |
| 26 |
|
| 27 |
; Instrument #2 - counts active instruments. |
| 28 |
instr 2 |
| 29 |
; Count the active instances of Instrument #1. |
| 30 |
icount active 1 |
| 31 |
; Print the number of active instances. |
| 32 |
print icount |
| 33 |
endin |
| 34 |
|
| 35 |
|
| 36 |
</CsInstruments> |
| 37 |
<CsScore> |
| 38 |
|
| 39 |
; Start the first instance of Instrument #1 at 0:00 seconds. |
| 40 |
i 1 0.0 3.0 |
| 41 |
|
| 42 |
; Start the second instance of Instrument #1 at 0:015 seconds. |
| 43 |
i 1 1.5 1.5 |
| 44 |
|
| 45 |
; Play Instrument #2 at 0:01 seconds, when we have only |
| 46 |
; one active instance of Instrument #1. |
| 47 |
i 2 1.0 0.1 |
| 48 |
|
| 49 |
; Play Instrument #2 at 0:02 seconds, when we have |
| 50 |
; two active instances of Instrument #1. |
| 51 |
i 2 2.0 0.1 |
| 52 |
e |
| 53 |
|
| 54 |
|
| 55 |
</CsScore> |
| 56 |
</CsoundSynthesizer> |