]> Shamusworld >> Repos - ardour-manual/blob - include/generic-midi-binding-maps.html
Correctiong bad links
[ardour-manual] / include / generic-midi-binding-maps.html
1
2 <p>
3   Ardour 2.X supported
4   <a href="@@generic-midi-learn"><dfn>MIDI learning</dfn></a>
5   for more or less any control. This was a nice feature that quite a few other
6   DAWs are providing by now, but it didn't allow Ardour to work "out of the
7   box" with sensible defaults for existing commercial MIDI
8   controllers. In Ardour 3 and later versions, we have augmented the
9   MIDI learn feature with the ability to load a <dfn>MIDI binding map</dfn>
10   for a given controller, which can set up an arbitrary number of physical
11   controls with anything inside Ardour that can be controlled.
12 </p>
13 <p>
14   Currently (August 2016), we have presets for the following devices/modes:
15 </p>
16 <ul>
17   <li>AKAI MPD-32</li>
18   <li>AKAI MPK61</li>
19   <li>AKAI MPKmini</li>
20   <li>Behringer BCF2000</li>
21   <li>Behringer BCF2000 (Mackie Emulation mode; better to use
22     Ardour's actual Mackie Control Protocol support)</li>
23   <li>Behringer DDX3216</li>
24   <li>Korg nanoKONTROL (2 layouts)</li>
25   <li>Korg nanoKONTROL 2 (2 layouts)</li>
26   <li>Korg Taktile</li>
27   <li>M-Audio Axiom 25 (2 layouts)</li>
28   <li>M-Audio Axiom 61</li>
29   <li>M-Audio Oxygen 49</li>
30   <li>M-Audio Oxygen 61v3</li>
31   <li>M-Audio Oxygen 25</li>
32   <li>M-Audio Oxygen 8v2</li>
33   <li>Novation Impulse 49</li>
34   <li>Novation Impulse 61</li>
35   <li>Novation LaunchControl XL</li>
36   <li>Novation LaunchKey 25</li>
37   <li>Roland SI-24</li>
38   <li>Roland V Studio 20</li>
39   <li>Yamaha KX25</li>
40 </ul>
41   At this time, new binding maps need to be created with a text editor.
42 <p>
43   MIDI binding maps are accessible by double-clicking <kbd class="menu">Edit
44   &gt; Preferences &gt; Control Surfaces &gt; Generic MIDI</kbd>. Ardour will
45   retain your selection after you choose one.
46 </p>
47
48 <h2>Creating new MIDI maps</h2>
49 <h3>The Basic Concept</h3>
50 <p>
51   Since the beginning of time (well, sometime early in the 2.X series),
52   Ardour has had the concept of identifying each track and bus with a
53   <dfn>remote control ID</dfn>. This ID uniquely identifies a track or bus
54   so that when messages arrive from elsewhere via MIDI or OSC , we can determine
55    which track or bus they are intended to control. See
56    <a href="@@controlling-track-ordering">
57    remote control IDs</a> for more information.
58    You just need to know that there is a "first track" and its remote control
59    ID is 1, and so on.
60 </p>
61 <h3>Getting Started</h3>
62 <p>
63   MIDI bindings are stored in files with the suffix ".map" attached to their
64   name. The minimal content looks like this:
65 </p>
66 <pre>
67 &lt;?xml version="1.0" encoding="UTF-8"?&gt;
68 &lt;ArdourMIDIBindings version="1.0.0" name="The name of this set of
69 bindings"&gt;
70 &lt;/ArdourMIDIBindings&gt;
71 </pre>
72 <p>
73   So, to start, create a file with that as the initial contents.
74 </p>
75 <p>
76   On OS X, Ardour loads midi maps from its binary-bundle folder in
77   <code>Ardour-&lt;version&gt;/midi_maps/</code> and checks
78   various other locations as well (defined by the ARDOUR_MIDIMAPS_PATH
79   environment variable). On GNU/Linux the easiest is to save the file to
80   <code>~/.config/ardour3/midi_maps/</code>.
81 </p>
82
83 <h3>Finding out what your MIDI control surface sends</h3>
84 <p>
85   This is the most complex part of the job, but its still not very hard.
86   You need to connect the control surface to an application that will show
87   you the information that the device sends each time you modify a knob,
88   slider, button etc. There are a variety of such applications (notably
89   <code>gmidimon</code> and <code>kmidimon</code>, but you can actually use
90   Ardour for this if you want. Start Ardour in a terminal window, connect
91   MIDI ports up, and in the Preferences window, enable "Trace Input" on the
92   relevant MIDI port. A full trace of the MIDI data received will show up in
93   the terminal window. (Note: in Ardour3, you get a dedicated, custom dialog
94   for this kind of tracing.)
95 </p>
96 <h3>Types of Bindings</h3>
97 <p>
98   There are two basic kinds of bindings you can make between a MIDI message
99   and something inside Ardour. The first is a binding to a specific parameter
100   of a track or bus. The second is a binding to a function that will change
101   Ardour's state in some way.
102 </p>
103 <h4>Binding to Track/Bus controls</h4>
104 <p>
105   A track/bus binding has one of two basic structures
106 </p>
107 <code>
108   &lt;Binding <em>msg specification</em>  uri="<em>&hellip; control address &hellip;</em>"/&gt;
109   &lt;Binding <em>msg specification</em>  function="<em>&hellip; function name &hellip;</em>"/&gt;
110 </code>
111
112 <h4>Message specifications</h4>
113 <p>
114   You can create a binding for either 3 types of channel messages, or for a
115   system exclusive ("sysex") message.  A channel message specification looks
116   like this:
117 </p>
118 <code>
119    &lt;Binding channel="1" ctl="13" &hellip;.
120 </code>
121 <p>
122   This defines a binding for a MIDI Continuous Controller message involving
123   controller 13, arriving on channel 1. There are 16 MIDI channels, numbered
124   1 to 16. Where the example above says <code>ctl</code>, you can alternatively
125   use <code>note</code> (to create binding for a Note On message) or
126   <code>pgm</code>  (to create a binding for a Program Change message).
127 </p>
128 <p>
129   As of Ardour 4.2, <code>enc-r</code>, <code>enc-l</code>, <code>enc-2</code> and
130   <code>enc-b</code> may be used for surfaces that have encoders that send
131   offsets rather than values. These accept Continuous Controller messages
132   but treat them as offsets. These are good for banked controls as they are
133   always at the right spot to start adjusting. (
134    <a href="@@generic-midi-and-encoders">
135    Learn more about working with encoders
136    </a>)
137 </p>
138 <p>
139   You can also bind sysex messages:
140 </p>
141 <code>
142   &lt;Binding sysex="f0 0 0 e 9 0 5b f7" &hellip;.
143   &lt;Binding sysex="f0 7f 0 6 7 f7" &hellip;.
144 </code>
145 <p>
146   The string after the <code>sysex=</code> part is the sequence of MIDI bytes,
147   as hexadecimal values, that make up the sysex message.
148 </p>
149 <p>
150   Finally, you can bind a totally arbitrary MIDI message:</p>
151 <code>
152   &lt;Binding msg="f0 0 0 e 9 0 5b f7" &hellip;.
153   &lt;Binding msg="80 60 40" &hellip;.
154 </code>
155 <p>
156   The string after the <code>msg=</code> part is the sequence of MIDI bytes, as
157   hexadecimal values, that make up the message you want to bind. Using this is
158   slightly less efficient than the other variants shown above, but is useful for
159   some oddly designed control devices.
160 </p>
161
162 <p class="note">
163   As of Ardour 4.6 it is possible to use multi-event MIDI strings such as
164   two event CC messages, RPN or NRPN.
165 </p>
166
167 <p class="note">
168   The <code>sysex=</code> and <code>msg=</code> bindings will only work with
169   <code>function=</code> or <code>action=</code> control addresses. They
170   will <em>not</em> work with the <code>uri=</code> control addresses.
171   Controls used with <code>uri=</code> require a <em>Value</em> which is
172   only available in a known place with channel mode MIDI events.
173 </p>
174
175 <h4>Control address</h4>
176 <p>
177   A <dfn>control address</dfn> defines what the binding will actually control.
178   There are quite a few different things that can be specified here:
179 </p>
180 <table class="dl">
181 <tr><th>/route/gain</th>
182 <td>the gain control ("fader") for the track/bus</td></tr>
183 <tr><th>/route/trim</th>
184 <td>the trim control for the track/bus (new in 4.1)</td></tr>
185 <tr><th>/route/solo</th>
186 <td>a toggleable control for solo (and listen) of the track/bus</td></tr>
187 <tr><th>/route/mute</th>
188 <td>a toggleable control to mute/unmute the track/bus</td></tr>
189 <tr><th>/route/recenable</th>
190 <td>a toggleable control to record-enable the track</td></tr>
191 <tr><th>/route/panwidth</th>
192 <td>interpreted by the track/bus panner, should control image "width"</td></tr>
193 <tr><th>/route/pandirection</th>
194 <td>interpreted by the track/bus panner, should control image "direction"</td></tr>
195 <tr><th>/route/plugin/parameter</th>
196 <td>the Mth parameter of the Nth plugin of a track/bus
197 </td></tr>
198 <tr><th>/route/send/gain</th>
199 <td>the gain control ("fader") of the Nth send of a track/bus</td></tr>
200 </table>
201 <p>Each of the specifications needs an address, which takes various forms too. For track-level controls (solo/gain/mute/recenable), the address is one the following:</p>
202 <table class="dl">
203 <tr><th>a number, eg. "1"
204 </th>
205 <td>identifies a track or bus by its remote control ID
206 </td></tr>
207 <tr><th>B, followed by a number
208 </th>
209 <td>identifies a track or bus by its remote control ID within the current bank (see below for more on banks)
210 </td></tr>
211 <tr><th>S, followed by a number
212 </th>
213 <td>identifies a selected track in order they have been selected, S1 should be the same track as the Editor Mixer
214 </td></tr>
215 <tr><th>one or more words
216 </th>
217 <td>identifies a track or bus by its name
218 </td></tr>
219 </table>
220 <p>
221   For send/insert/plugin controls, the address consists of a track/bus
222   address (as just described) followed by a number identifying the plugin/send
223   (starting from 1). For plugin parameters, there is an additional third
224   component: a number identifying the plugin parameter number (starting from
225   1).
226 </p>
227 <p>
228   One additional feature: for solo and mute bindings, you can also add
229   <code>momentary="yes"</code> after the control address. This is useful
230   primarily for NoteOn bindings&mdash;when Ardour gets the NoteOn it
231   will solo or mute the targetted track or bus, but then when a NoteOff
232   arrives, it will un-solo or un-mute it.
233 </p>
234
235 <h4>Bindings to Ardour "functions"</h4>
236 <p>
237   Rather than binding to a specific track/bus control, it may be useful to
238   have a MIDI controller able to alter some part of Ardour's state. A
239   binding definition that does this looks like this:
240 </p>
241 <code>
242   &lt;Binding channel="1" note="13" function="transport-roll"/&gt;
243 </code>
244 <p>
245   In this case, a NoteOn message for note number 13 (on channel 1) will
246   start the transport rolling. The following function names are available:
247 </p>
248 <table class="dl">
249 <tr><th>
250 <code>transport-stop</code>
251 </th>
252 <td>stop the transport
253 </td></tr>
254 <tr><th>
255 <code>transport-roll</code>
256 </th>
257 <td>start the transport "rolling"
258 </td></tr>
259 <tr><th>
260 <code>transport-zero</code>
261 </th>
262 <td>move the playhead to the zero position
263 </td></tr>
264 <tr><th>
265 <code>transport-start</code>
266 </th>
267 <td>move the playhead to the start marker
268 </td></tr>
269 <tr><th>
270 <code>transport-end</code>
271 </th>
272 <td>move the playhead to the end marker
273 </td></tr>
274 <tr><th>
275 <code>loop-toggle</code>
276 </th>
277 <td>turn on loop playback
278 </td></tr>
279 <tr><th>
280 <code>rec-enable</code>
281 </th>
282 <td>enable the global record button
283 </td></tr>
284 <tr><th>
285 <code>rec-disable</code>
286 </th>
287 <td>disable the global record button
288 </td></tr>
289 <tr><th>
290 <code>next-bank</code>
291 </th>
292 <td>Move track/bus mapping to the next bank (see Banks below)
293 </td></tr>
294 <tr><th>
295 <code>prev-bank</code>
296 </th>
297 <td>Move track/bus mapping to the previous bank (see Banks below)
298 </td></tr>
299 </table>
300
301 <h4>Binding to Ardour "actions"</h4>
302 <p>
303   You can also bind a sysex or arbitrary message to any of the items
304   that occur in Ardour's main menu (and its submenus). The <a
305   href="/appendix/menu-actions-list/">
306   list of actions</a> shows all available values of <em>action-name</em>.
307 <p>
308   To create a binding between an arbitrary MIDI message (we'll use a
309   note-off on channel 1 of MIDI note 60 (hex) with release velocity
310   40 (hex)), the binding file would contain:
311 </p>
312 <code>
313    &lt;Binding msg="80 60 40" action="Editor/temporal-zoom-in"/&gt;
314 </code>
315 <p>
316   The general rule, when taken an item from the keybindings file and
317   using it in a MIDI binding is to simply strip the
318   <code>&lt;Action&gt;</code> prefix of the second field in the
319   keybinding definition.
320 </p>
321
322 <h3>Banks and Banking</h3>
323 <p>
324   Because many modern control surfaces offer per-track/bus controls
325   for far fewer tracks &amp; busses than many users want to control,
326   Ardour offers the relatively common place concept of <dfn>banks</dfn>. Banks
327   allow you to control any number of tracks and/or busses easily,
328   regardless of how many faders/knobs etc. your control surface has.<br>
329   To use banking, the control addresses must be specified using the
330   <dfn>bank relative</dfn> format mentioned above ("B1" to identify
331   the first track of a bank of tracks, rather than "1" to identify
332   the first track).
333 </p>
334 <p>
335   One very important extra piece of information is required to use
336   banking: an extra line near the start of the list of bindings
337   that specifies how many tracks/busses to use per bank. If the
338   device has 8 faders, then 8 would be a sensible value to use for
339   this. The line looks like this:</p>
340 <code>
341    &lt;DeviceInfo bank-size="8"/&gt;
342 </code>
343 <p>
344   In addition, you probably want to ensure that you bind something
345   on the control surface to the <code>next-bank</code> and
346   <code>prev-bank</code> functions, otherwise you and other users
347   will have to use the mouse and the GUI to change banks, which
348   rather defeats the purpose of the bindings.
349 </p>
350 <h3>The Selected Strip</h3>
351 <p>
352   Often times one wants to just deal with the strip currently
353   selected by the GUI (or the control surface). In the same way as with
354   banks above the selected strip can be designated with <em>S1</em>.
355 </p>
356 <h2>A Complete (though muddled) Example</h2>
357 <pre>
358 &lt;?xml version="1.0" encoding="UTF-8"?&gt;
359 &lt;ArdourMIDIBindings version="1.0.0" name="pc1600x transport controls"&gt;
360   &lt;DeviceInfo bank-size="16"/&gt;
361   &lt;Binding channel="1" ctl="1"   uri="/route/gain B1"/&gt;
362   &lt;Binding channel="1" ctl="2"   uri="/route/gain B2"/&gt;
363   &lt;Binding channel="1" ctl="3"   uri="/route/send/gain B1 1"/&gt;
364   &lt;Binding channel="1" ctl="4"   uri="/route/plugin/parameter B1 1 1"/&gt;
365   &lt;Binding channel="1" ctl="6"   uri="/bus/gain master"/&gt;
366
367   &lt;Binding channel="1" note="1"  uri="/route/solo B1"/&gt;
368   &lt;Binding channel="1" note="2"  uri="/route/solo B2" momentary="yes"/&gt;
369
370   &lt;Binding channel="1" note="15"  uri="/route/mute B1" momentary="yes"/&gt;
371   &lt;Binding channel="1" note="16"  uri="/route/mute B2" momentary="yes"/&gt;
372
373   &lt;Binding sysex="f0 0 0 e 9 0 5b f7" function="transport-start"/&gt;
374   &lt;Binding sysex="f0 7f 0 6 7 f7" function="rec-disable"/&gt;
375   &lt;Binding sysex="f0 7f 0 6 6 f7" function="rec-enable"/&gt;
376   &lt;Binding sysex="f0 0 0 e 9 0 53 0 0 f7" function="loop-toggle"/&gt;
377
378   &lt;Binding channel="1" note="13" function="transport-roll"/&gt;
379   &lt;Binding channel="1" note="14" function="transport-stop"/&gt;
380   &lt;Binding channel="1" note="12" function="transport-start"/&gt;
381   &lt;Binding channel="1" note="11" function="transport-zero"/&gt;
382   &lt;Binding channel="1" note="10" function="transport-end"/&gt;
383 &lt;/ArdourMIDIBindings&gt;
384 </pre>
385 <p>
386   Please note that channel, controller and note numbers are specified as
387   decimal numbers in the ranges 1-16, 0-127 and 0-127 respectively
388   (the channel range may change at some point).
389 </p>