| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac -m0 --midi-key=4 --midi-velocity-amp=5 ; treat p4 and p5 as midi data |
| 5 |
; For Non-realtime ouput leave only the line below: |
| 6 |
; -o mxadsr-2.wav -W ;;; for file output any platform |
| 7 |
</CsOptions> |
| 8 |
<CsInstruments> |
| 9 |
|
| 10 |
sr = 44100 |
| 11 |
ksmps = 32 |
| 12 |
nchnls = 2 |
| 13 |
0dbfs = 1 |
| 14 |
|
| 15 |
; by Menno Knevel - 2021 |
| 16 |
|
| 17 |
instr 1 ; use score and treat p4 and p5 as midi data |
| 18 |
icps = cpsmidinn(p4) ; take midi note (p4) from score |
| 19 |
iveloc ampmidid p5, 92 ; take velocity (p5) from score |
| 20 |
; att, dec, lvl, release |
| 21 |
kenv mxadsr .001, .2, 1, p6 |
| 22 |
prints "duration of note (%ds) + release (%2.1fs)\\n", p3, p6 ; |
| 23 |
asig vco2 iveloc, icps |
| 24 |
asig butlp asig, 2000 |
| 25 |
outs asig*kenv, asig*kenv |
| 26 |
|
| 27 |
endin |
| 28 |
</CsInstruments> |
| 29 |
<CsScore> |
| 30 |
; note vel release |
| 31 |
s |
| 32 |
i 1 0 1 62 60 0 |
| 33 |
i 1 2 1 62 80 0 |
| 34 |
i 1 4 1 62 100 0 |
| 35 |
i 1 6 1 58 50 0 |
| 36 |
s |
| 37 |
i 1 1 1 62 60 0 |
| 38 |
i 1 3 1 62 80 1 |
| 39 |
i 1 5 1 62 100 3 |
| 40 |
i 1 7 1 58 50 5 |
| 41 |
e |
| 42 |
</CsScore> |
| 43 |
</CsoundSynthesizer> |