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