summaryrefslogtreecommitdiff
path: root/midi/virtual.xml
blob: 1dce421a4fe87f78a2de72902dbd167f670355f9 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<section id="MidiVirtual">
  <title>Virtual MIDI Keyboard</title>

  <para>
    <mediaobject>
      <imageobject>
        <imagedata fileref="images/virtualkeyboard.png" format="PNG"/>
      </imageobject>

      <textobject>
        <phrase>[Virtual MIDI keyboard]</phrase>
      </textobject>

      <caption>
        <para>Virtual MIDI keyboard.</para>
      </caption>
    </mediaobject>
  </para>

  <para>
    The virtual MIDI keyboard module (activated using -+rtmidi=virtual on the
    command line flags) provides a way of sending realtime MIDI information to
    Csound without the need of a MIDI device. It can send note information,
    control changes, bank and program changes on a specified channel. The MIDI
    information from the virtual keyboard is processed by Csound in exactly the
    same way as MIDI information that comes from the other MIDI drivers, so if
    your Csound orchestra is designed to work with hardware MIDI devices, this
    will also work.
  </para>

  <para>
    For the device flag (-M), the virtual keyboard uses this to take in the name
    of a keyboard mapping files. Like all MIDI drivers, a device must be given
    to activate the driver. If you would like to just use the default settings
    of the keyboard, simply passing in 0 (i.e. -M0) and the virtual keyboard
    will use its default settings. If instead of the 0 a name of a file is
    given, the keyboard will attempt to load the file as a keyboard mapping. If
    the file could not be opened or read correctly, the default settings will be
    used.
  </para>

  <para>
    Keyboard Mapping files allow the user to customize the name and number of banks
    as well as the name and number of programs per bank.  The following example
    keyboard mapping (named keyboard.map) has inline comments on the file format.
    This file is also available with the Csound source distribution in the
    InOut/virtual_keyboard folder.
  </para>

<programlisting>
# Custom Keyboard Map for Virtual Keyboard
# Steven Yi
#
# USAGE
#
# When using the Virtual Keyboard, you can supply a filename for a mapping
# of banks and programs via the -M flag, for example:
#
# csound -+rtmidi=virtual -Mkeyboard.map my_project.csd
#
# INFORMATION ON THE FORMAT
#
# -lines that start with '#' are comments
# -lines that have [] start new bank definitions,
#  the contents are bankNum=bankName, with bankNum=[1,16384]
# -lines following bank statements are program definitions
#  in the format programNum=programName, with programNum=[1,128]
# -bankNumbers and programNumbers are defined in this file
#  starting with 1, but are converted to midi values (starting
#  with 0) when read
#
# NOTES
#
# -if an invalid bank definition is found, all program
#  defintions that follow will be ignored until a new
#  valid bank definition is found
# -if a valid bank is defined by no valid programs found
#  for that bank, it will default to General MIDI program
#  definitions
# -if an invalid program definition is found, it will be
#  ignored

[1=My Bank]
1=My Test Patch 1
2=My Test Patch 2
30=My Test Patch 30

[2=My Bank2]
1=My Test Patch 1(bank2)
2=My Test Patch 2(bank2)
30=My Test Patch 30(bank3)
</programlisting>

  <para>
    The ten sliders up top are by default set to MIDI Controller number 1-10
    though they can be changed to whatever one wishes to use. The controller
    numbers and values of each slider are set per channel, so one may use
    different settings and values for each channel.
  </para>

  <para>
    By default there are 128 banks and for each bank 128 patches defaulting to
    General Midi names. The MIDI bank standard uses 14-bit resolution to support
    16384 possible banks, but the bank numbers by default are 0-127. To use
    values higher than 127, one should use a custom keyboard map and set the
    desired bank number value for the bank name. The virtual keyboard will
    correctly transmit the bank number as MSB and LSB with controller numbers 0
    and 32.
  </para>

  <para>
    Beyond the input available from interacting with the GUI via mouse, one may
    also trigger off MIDI notes by using the ASCII keyboard when the virtual
    keyboard window is focused. The layout is done much like a tracker and offers
    two octaves and a major third to trigger, starting from Middle-C (MIDI note 60).
    The ASCII keyboard MIDI note values are given in the following table.
  </para>

    <table>
      <title>ASCII Keyboard MIDI Note Values</title>
      <tgroup cols="2">
        <thead>
          <row>
            <entry>Keyboard Key</entry>
            <entry>MIDI Value</entry>
          </row>
        </thead>
        <tbody>

        <row>
            <entry>z</entry>
            <entry>60</entry>
          </row>

          <row>
            <entry>s</entry>
            <entry>61</entry>
          </row>

          <row>
            <entry>x</entry>
            <entry>62</entry>
          </row>

          <row>
            <entry>d</entry>
            <entry>63</entry>
          </row>

          <row>
            <entry>c</entry>
            <entry>64</entry>
          </row>

          <row>
            <entry>v</entry>
            <entry>65</entry>
          </row>

          <row>
            <entry>g</entry>
            <entry>66</entry>
          </row>

          <row>
            <entry>b</entry>
            <entry>67</entry>
          </row>

          <row>
            <entry>h</entry>
            <entry>68</entry>
          </row>

          <row>
            <entry>n</entry>
            <entry>69</entry>
          </row>

          <row>
            <entry>j</entry>
            <entry>70</entry>
          </row>

          <row>
            <entry>m</entry>
            <entry>71</entry>
          </row>

          <row>
            <entry>q</entry>
            <entry>72</entry>
          </row>

          <row>
            <entry>2</entry>
            <entry>73</entry>
          </row>

          <row>
            <entry>w</entry>
            <entry>74</entry>
          </row>

          <row>
            <entry>3</entry>
            <entry>75</entry>
          </row>

          <row>
            <entry>e</entry>
            <entry>76</entry>
          </row>

          <row>
            <entry>r</entry>
            <entry>77</entry>
          </row>

          <row>
            <entry>5</entry>
            <entry>78</entry>
          </row>

          <row>
            <entry>t</entry>
            <entry>79</entry>
          </row>

          <row>
            <entry>6</entry>
            <entry>80</entry>
          </row>

          <row>
            <entry>y</entry>
            <entry>81</entry>
          </row>

          <row>
            <entry>7</entry>
            <entry>82</entry>
          </row>

          <row>
            <entry>u</entry>
            <entry>83</entry>
          </row>

          <row>
            <entry>i</entry>
            <entry>84</entry>
          </row>

          <row>
            <entry>9</entry>
            <entry>85</entry>
          </row>

          <row>
            <entry>o</entry>
            <entry>86</entry>
          </row>

          <row>
            <entry>0</entry>
            <entry>87</entry>
          </row>

          <row>
            <entry>p</entry>
            <entry>88</entry>
          </row>



        </tbody>
      </tgroup>
    </table>
    <para>
      Here's an example of usage of the virtual MIDI keyboard. It uses the file <ulink url="examples/virtual.csd"><citetitle>virtual.csd</citetitle></ulink>.
 <xi:include href="examples-xml/virtual.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    </para>


</section>