| 1 | <section id="MidiVirtual"> |
| 2 | <title>Virtual MIDI Keyboard</title> |
| 3 | |
| 4 | <para> |
| 5 | <mediaobject> |
| 6 | <imageobject> |
| 7 | <imagedata fileref="images/virtualkeyboard.png" format="PNG"/> |
| 8 | </imageobject> |
| 9 | |
| 10 | <textobject> |
| 11 | <phrase>[Virtual MIDI keyboard]</phrase> |
| 12 | </textobject> |
| 13 | |
| 14 | <caption> |
| 15 | <para>Virtual MIDI keyboard.</para> |
| 16 | </caption> |
| 17 | </mediaobject> |
| 18 | </para> |
| 19 | |
| 20 | <para> |
| 21 | The Virtual Keyboard is a Plugin in widgets. This opcode is part of the plugin repository and has to be installed separately. This FLTK widget does not work on the Mac. |
| 22 | The plugin repository can be found here: <ulink url="https://github.com/csound/plugins"><citetitle>https://github.com/csound/plugins</citetitle></ulink></para> |
| 23 | |
| 24 | <para> |
| 25 | The virtual MIDI keyboard module (activated using -+rtmidi=virtual on the |
| 26 | command line flags) provides a way of sending realtime MIDI information to |
| 27 | Csound without the need of a MIDI device. It can send note information, |
| 28 | control changes, bank and program changes on a specified channel. The MIDI |
| 29 | information from the virtual keyboard is processed by Csound in exactly the |
| 30 | same way as MIDI information that comes from the other MIDI drivers, so if |
| 31 | your Csound orchestra is designed to work with hardware MIDI devices, this |
| 32 | will also work. |
| 33 | </para> |
| 34 | |
| 35 | <para> |
| 36 | For the device flag (-M), the virtual keyboard uses this to take in the name |
| 37 | of a keyboard mapping files. Like all MIDI drivers, a device must be given |
| 38 | to activate the driver. If you would like to just use the default settings |
| 39 | of the keyboard, simply passing in 0 (i.e. -M0) and the virtual keyboard |
| 40 | will use its default settings. If instead of the 0 a name of a file is |
| 41 | given, the keyboard will attempt to load the file as a keyboard mapping. If |
| 42 | the file could not be opened or read correctly, the default settings will be |
| 43 | used. |
| 44 | </para> |
| 45 | |
| 46 | <para> |
| 47 | Keyboard Mapping files allow the user to customize the name and number of banks |
| 48 | as well as the name and number of programs per bank. The following example |
| 49 | keyboard mapping (named keyboard.map) has inline comments on the file format. |
| 50 | This file is also available with the Csound source distribution in the |
| 51 | InOut/virtual_keyboard folder. |
| 52 | </para> |
| 53 | |
| 54 | <programlisting> |
| 55 | # Custom Keyboard Map for Virtual Keyboard |
| 56 | # Steven Yi |
| 57 | # |
| 58 | # USAGE |
| 59 | # |
| 60 | # When using the Virtual Keyboard, you can supply a filename for a mapping |
| 61 | # of banks and programs via the -M flag, for example: |
| 62 | # |
| 63 | # csound -+rtmidi=virtual -Mkeyboard.map my_project.csd |
| 64 | # |
| 65 | # INFORMATION ON THE FORMAT |
| 66 | # |
| 67 | # -lines that start with '#' are comments |
| 68 | # -lines that have [] start new bank definitions, |
| 69 | # the contents are bankNum=bankName, with bankNum=[1,16384] |
| 70 | # -lines following bank statements are program definitions |
| 71 | # in the format programNum=programName, with programNum=[1,128] |
| 72 | # -bankNumbers and programNumbers are defined in this file |
| 73 | # starting with 1, but are converted to midi values (starting |
| 74 | # with 0) when read |
| 75 | # |
| 76 | # NOTES |
| 77 | # |
| 78 | # -if an invalid bank definition is found, all program |
| 79 | # defintions that follow will be ignored until a new |
| 80 | # valid bank definition is found |
| 81 | # -if a valid bank is defined by no valid programs found |
| 82 | # for that bank, it will default to General MIDI program |
| 83 | # definitions |
| 84 | # -if an invalid program definition is found, it will be |
| 85 | # ignored |
| 86 | |
| 87 | [1=My Bank] |
| 88 | 1=My Test Patch 1 |
| 89 | 2=My Test Patch 2 |
| 90 | 30=My Test Patch 30 |
| 91 | |
| 92 | [2=My Bank2] |
| 93 | 1=My Test Patch 1(bank2) |
| 94 | 2=My Test Patch 2(bank2) |
| 95 | 30=My Test Patch 30(bank3) |
| 96 | </programlisting> |
| 97 | |
| 98 | <para> |
| 99 | The ten sliders up top are by default set to MIDI Controller number 1-10 |
| 100 | though they can be changed to whatever one wishes to use. The controller |
| 101 | numbers and values of each slider are set per channel, so one may use |
| 102 | different settings and values for each channel. |
| 103 | </para> |
| 104 | |
| 105 | <para> |
| 106 | By default there are 128 banks and for each bank 128 patches defaulting to |
| 107 | General Midi names. The MIDI bank standard uses 14-bit resolution to support |
| 108 | 16384 possible banks, but the bank numbers by default are 0-127. To use |
| 109 | values higher than 127, one should use a custom keyboard map and set the |
| 110 | desired bank number value for the bank name. The virtual keyboard will |
| 111 | correctly transmit the bank number as MSB and LSB with controller numbers 0 |
| 112 | and 32. |
| 113 | </para> |
| 114 | |
| 115 | <para> |
| 116 | Beyond the input available from interacting with the GUI via mouse, one may |
| 117 | also trigger off MIDI notes by using the ASCII keyboard when the virtual |
| 118 | keyboard window is focused. The layout is done much like a tracker and offers |
| 119 | two octaves and a major third to trigger, starting from Middle-C (MIDI note 60). |
| 120 | The ASCII keyboard MIDI note values are given in the following table. |
| 121 | </para> |
| 122 | |
| 123 | <table> |
| 124 | <title>ASCII Keyboard MIDI Note Values</title> |
| 125 | <tgroup cols="2"> |
| 126 | <thead> |
| 127 | <row> |
| 128 | <entry>Keyboard Key</entry> |
| 129 | <entry>MIDI Value</entry> |
| 130 | </row> |
| 131 | </thead> |
| 132 | <tbody> |
| 133 | |
| 134 | <row> |
| 135 | <entry>z</entry> |
| 136 | <entry>60</entry> |
| 137 | </row> |
| 138 | |
| 139 | <row> |
| 140 | <entry>s</entry> |
| 141 | <entry>61</entry> |
| 142 | </row> |
| 143 | |
| 144 | <row> |
| 145 | <entry>x</entry> |
| 146 | <entry>62</entry> |
| 147 | </row> |
| 148 | |
| 149 | <row> |
| 150 | <entry>d</entry> |
| 151 | <entry>63</entry> |
| 152 | </row> |
| 153 | |
| 154 | <row> |
| 155 | <entry>c</entry> |
| 156 | <entry>64</entry> |
| 157 | </row> |
| 158 | |
| 159 | <row> |
| 160 | <entry>v</entry> |
| 161 | <entry>65</entry> |
| 162 | </row> |
| 163 | |
| 164 | <row> |
| 165 | <entry>g</entry> |
| 166 | <entry>66</entry> |
| 167 | </row> |
| 168 | |
| 169 | <row> |
| 170 | <entry>b</entry> |
| 171 | <entry>67</entry> |
| 172 | </row> |
| 173 | |
| 174 | <row> |
| 175 | <entry>h</entry> |
| 176 | <entry>68</entry> |
| 177 | </row> |
| 178 | |
| 179 | <row> |
| 180 | <entry>n</entry> |
| 181 | <entry>69</entry> |
| 182 | </row> |
| 183 | |
| 184 | <row> |
| 185 | <entry>j</entry> |
| 186 | <entry>70</entry> |
| 187 | </row> |
| 188 | |
| 189 | <row> |
| 190 | <entry>m</entry> |
| 191 | <entry>71</entry> |
| 192 | </row> |
| 193 | |
| 194 | <row> |
| 195 | <entry>q</entry> |
| 196 | <entry>72</entry> |
| 197 | </row> |
| 198 | |
| 199 | <row> |
| 200 | <entry>2</entry> |
| 201 | <entry>73</entry> |
| 202 | </row> |
| 203 | |
| 204 | <row> |
| 205 | <entry>w</entry> |
| 206 | <entry>74</entry> |
| 207 | </row> |
| 208 | |
| 209 | <row> |
| 210 | <entry>3</entry> |
| 211 | <entry>75</entry> |
| 212 | </row> |
| 213 | |
| 214 | <row> |
| 215 | <entry>e</entry> |
| 216 | <entry>76</entry> |
| 217 | </row> |
| 218 | |
| 219 | <row> |
| 220 | <entry>r</entry> |
| 221 | <entry>77</entry> |
| 222 | </row> |
| 223 | |
| 224 | <row> |
| 225 | <entry>5</entry> |
| 226 | <entry>78</entry> |
| 227 | </row> |
| 228 | |
| 229 | <row> |
| 230 | <entry>t</entry> |
| 231 | <entry>79</entry> |
| 232 | </row> |
| 233 | |
| 234 | <row> |
| 235 | <entry>6</entry> |
| 236 | <entry>80</entry> |
| 237 | </row> |
| 238 | |
| 239 | <row> |
| 240 | <entry>y</entry> |
| 241 | <entry>81</entry> |
| 242 | </row> |
| 243 | |
| 244 | <row> |
| 245 | <entry>7</entry> |
| 246 | <entry>82</entry> |
| 247 | </row> |
| 248 | |
| 249 | <row> |
| 250 | <entry>u</entry> |
| 251 | <entry>83</entry> |
| 252 | </row> |
| 253 | |
| 254 | <row> |
| 255 | <entry>i</entry> |
| 256 | <entry>84</entry> |
| 257 | </row> |
| 258 | |
| 259 | <row> |
| 260 | <entry>9</entry> |
| 261 | <entry>85</entry> |
| 262 | </row> |
| 263 | |
| 264 | <row> |
| 265 | <entry>o</entry> |
| 266 | <entry>86</entry> |
| 267 | </row> |
| 268 | |
| 269 | <row> |
| 270 | <entry>0</entry> |
| 271 | <entry>87</entry> |
| 272 | </row> |
| 273 | |
| 274 | <row> |
| 275 | <entry>p</entry> |
| 276 | <entry>88</entry> |
| 277 | </row> |
| 278 | |
| 279 | |
| 280 | |
| 281 | </tbody> |
| 282 | </tgroup> |
| 283 | </table> |
| 284 | <para> |
| 285 | 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>. |
| 286 | <xi:include href="examples-xml/virtual.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 287 | </para> |
| 288 | |
| 289 | |
| 290 | </section> |