Debian Codegraph @

examples/midicontrolchange.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -odac -+rtmidi=virtual -M0 ;;;realtime audio out and midi in
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 ; For Non-realtime ouput leave only the line below:
7 ; -o midicontrolchange.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 instr 1
17 ; use slider of contr. 7 of virtual keyboard
18 kcont init 1 ; max. volume
19 midicontrolchange 7, kcont, 0, 1; use controller 7, scaled between 0 and 1
20 printk2 kcont ; Display the key value when it changes and key is pressed
21
22 kenv madsr 0.5, 0.8, 0.8, 0.5 ; envelope multiplied by
23 asig pluck kenv*kcont, 220, 220, 2, 1 ; value of controller 7
24 outs asig, asig
25
26 endin
27 </CsInstruments>
28 <CsScore>
29 f 0 30
30 f 2 0 4096 10 1
31
32 i 1 10 2 ; play a note from score as well
33 e
34
35 </CsScore>
36 </CsoundSynthesizer>