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
|
<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out Audio in No messages MIDI in
-odac -iadc -d -M0 ;;;RT audio I/O with MIDI in
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 10
nchnls = 2
; Set MIDI channel 1 to play instr 1.
massign 1, 1
instr 1
; Returns MIDI note number - an integer in range (0-127)
iNum notnum
; Convert MIDI note number to Hz
iHz = (440.0*exp(log(2.0)*((iNum)-69.0)/12.0))
; Generate audio by indexing a table; fixed amplitude.
aosc oscil 10000, iHz, 1
; Since there is no enveloping, there will be clicks.
outs aosc, aosc
endin
</CsInstruments>
<CsScore>
; Generate a Sine-wave to be indexed at audio rate
; by the oscil opcode.
f1 0 16384 10 1
; Keep the score "open" for 1 hour so that MIDI
; notes can allocate new note events, arbitrarily.
f0 3600
e
</CsScore>
</CsoundSynthesizer>
|