| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
; Audio out |
| 5 |
-odac -M0 ;;;realtime audio out and realtime MIDI in |
| 6 |
;-iadc ;;;uncomment -iadc if realtime audio input is needed too |
| 7 |
; -o hsboscil_midi.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 |
; synth waveform |
| 17 |
giwave ftgen 1, 0, 1024, 10, 1, 1, 1, 1 |
| 18 |
; blending window |
| 19 |
giblend ftgen 2, 0, 1024, -19, 1, 0.5, 270, 0.5 |
| 20 |
|
| 21 |
instr 1 |
| 22 |
|
| 23 |
ibase = cpsoct(6) |
| 24 |
ioctcnt = 5 |
| 25 |
|
| 26 |
; all octaves sound alike. |
| 27 |
itona octmidi |
| 28 |
; velocity is mapped to brightness |
| 29 |
ibrite ampmidi 4 |
| 30 |
|
| 31 |
; Map an exponential envelope for the amplitude. |
| 32 |
kenv expon .8, 1, .01 |
| 33 |
asig hsboscil kenv, itona, ibrite, ibase, giwave, giblend, ioctcnt |
| 34 |
outs asig, asig |
| 35 |
|
| 36 |
endin |
| 37 |
</CsInstruments> |
| 38 |
<CsScore> |
| 39 |
|
| 40 |
i 1 0 30 ; play for 30 seconds |
| 41 |
e |
| 42 |
</CsScore> |
| 43 |
</CsoundSynthesizer> |