summaryrefslogtreecommitdiff
path: root/examples-xml/midinoteonkey.csd.xml
blob: ac4a6efd8f93cd6fb470b58fa380aa2a9a11cea0 (plain)
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
<programlisting>
<emphasis role="csdtag">&lt;CsoundSynthesizer&gt;</emphasis>
<emphasis role="csdtag">&lt;CsOptions&gt;</emphasis>
<emphasis role="comment">; Select audio/midi flags here according to platform</emphasis>
<emphasis role="comment">; Audio out   Audio in   No messages  MIDI in</emphasis>
-odac           -iadc     -d         -M0  <emphasis role="comment">;;;RT audio I/O with MIDI in</emphasis>
<emphasis role="comment">; For Non-realtime ouput leave only the line below:</emphasis>
<emphasis role="comment">; -o midinoteonkey.wav -W ;;; for file output any platform</emphasis>
<emphasis role="csdtag">&lt;/CsOptions&gt;</emphasis>
<emphasis role="csdtag">&lt;CsInstruments&gt;</emphasis>

<emphasis role="comment">; Initialize the global variables.</emphasis>
<emphasis role="ohdr">sr</emphasis> <emphasis role="op">=</emphasis> 44100
<emphasis role="ohdr">kr</emphasis> <emphasis role="op">=</emphasis> 4410
<emphasis role="ohdr">ksmps</emphasis> <emphasis role="op">=</emphasis> 10
<emphasis role="ohdr">nchnls</emphasis> <emphasis role="op">=</emphasis> 1

<emphasis role="comment">; Instrument #1.</emphasis>
<emphasis role="oblock">instr</emphasis> 1
  kkey <emphasis role="opc">init</emphasis> 0
  kvelocity <emphasis role="opc">init</emphasis> 0

  <emphasis role="opc">midinoteonkey</emphasis> kkey, kvelocity

  <emphasis role="comment">; Display the key value when it changes.</emphasis>
  <emphasis role="opc">printk2</emphasis> kkey
<emphasis role="oblock">endin</emphasis>


<emphasis role="csdtag">&lt;/CsInstruments&gt;</emphasis>
<emphasis role="csdtag">&lt;CsScore&gt;</emphasis>

<emphasis role="comment">; Play Instrument #1 for ten seconds.</emphasis>
<emphasis role="stamnt">i</emphasis> 1 0 10
<emphasis role="stamnt">e</emphasis>


<emphasis role="csdtag">&lt;/CsScore&gt;</emphasis>
<emphasis role="csdtag">&lt;/CsoundSynthesizer&gt;</emphasis>
</programlisting>