]> Shamusworld >> Repos - ardour-manual/blob - include/generic-midi-binding-maps.html
Fix missing word
[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         The file should be located in the midi_maps sub directory located in
77         the <a href="@@files-and-directories-ardour-knows-about">Ardour configuration directory</a>
78 </p>
79
80 <h3>Finding out what your MIDI control surface sends</h3>
81 <p>
82   This is the most complex part of the job, but its still not very hard.
83   You need to connect the control surface to an application that will show
84   you the information that the device sends each time you modify a knob,
85   slider, button etc. There are a variety of such applications (notably
86   <code>gmidimon</code> and <code>kmidimon</code>, but you can actually use
87   Ardour for this if you want. Start Ardour in a terminal window, connect
88   MIDI ports up, and in the Preferences window, enable "Trace Input" on the
89   relevant MIDI port. A full trace of the MIDI data received will show up in
90   the terminal window. (Note: in Ardour3, you get a dedicated, custom dialog
91   for this kind of tracing.)
92 </p>
93 <h3>Types of Bindings</h3>
94 <p>
95   There are two basic kinds of bindings you can make between a MIDI message
96   and something inside Ardour. The first is a binding to a specific parameter
97   of a track or bus. The second is a binding to a function that will change
98   Ardour's state in some way.
99 </p>
100 <h4>Binding to Track/Bus controls</h4>
101 <p>
102   A track/bus binding has one of two basic structures
103 </p>
104 <code>
105   &lt;Binding <em>msg specification</em>  uri="<em>&hellip; control address &hellip;</em>"/&gt;
106   &lt;Binding <em>msg specification</em>  function="<em>&hellip; function name &hellip;</em>"/&gt;
107 </code>
108
109 <h4>Message specifications</h4>
110 <p>
111   You can create a binding for either 3 types of channel messages, or for a
112   system exclusive ("sysex") message.  A channel message specification looks
113   like this:
114 </p>
115 <code>
116    &lt;Binding channel="1" ctl="13" &hellip;
117 </code>
118 <p>
119   This defines a binding for a MIDI Continuous Controller message involving
120   controller 13, arriving on channel 1. There are 16 MIDI channels, numbered
121   1 to 16. Where the example above says <code>ctl</code>, you can alternatively
122   use <code>note</code> (to create binding for a Note On message) or
123   <code>pgm</code>  (to create a binding for a Program Change message).
124 </p>
125 <p>
126   As of Ardour 4.2, <code>enc-r</code>, <code>enc-l</code>, <code>enc-2</code> and
127   <code>enc-b</code> may be used for surfaces that have encoders that send
128   offsets rather than values. These accept Continuous Controller messages
129   but treat them as offsets. These are good for banked controls as they are
130   always at the right spot to start adjusting. (
131    <a href="@@generic-midi-and-encoders">
132    Learn more about working with encoders
133    </a>)
134 </p>
135 <p>
136         <ul>
137                 <li><code>&lt;Binding channel="1" enc-r="13" &hellip;</code></li>
138                 <li><code>&lt;Binding channel="1" enc-l="13" &hellip;</code></li>
139                 <li><code>&lt;Binding channel="1" enc-2="13" &hellip;</code></li>
140                 <li><code>&lt;Binding channel="1" enc-b="13" &hellip;</code></li>
141         </ul>
142         The <code>enc-*</code> value is the CC number used by the encoder.
143         Encoders only work with CC messages.
144 </p>
145 <p class="note">
146         Ardour 5.12 has a bug with the encoder detection where the first
147         encoder message resets the control to 0. Setting "Enable Feedback"
148         on allows encoders to work as expected.
149 </p>
150 <p>
151   You can also bind sysex messages:
152 </p>
153 <code>
154   &lt;Binding sysex="f0 0 0 e 9 0 5b f7" &hellip;.
155   &lt;Binding sysex="f0 7f 0 6 7 f7" &hellip;.
156 </code>
157 <p>
158   The string after the <code>sysex=</code> part is the sequence of MIDI bytes,
159   as hexadecimal values, that make up the sysex message.
160 </p>
161 <p>
162   Finally, you can bind a totally arbitrary MIDI message:</p>
163 <code>
164   &lt;Binding msg="f0 0 0 e 9 0 5b f7" &hellip;.
165   &lt;Binding msg="80 60 40" &hellip;.
166 </code>
167 <p>
168   The string after the <code>msg=</code> part is the sequence of MIDI bytes, as
169   hexadecimal values, that make up the message you want to bind. Using this is
170   slightly less efficient than the other variants shown above, but is useful for
171   some oddly designed control devices.
172 </p>
173
174 <p class="note">
175   As of Ardour 4.6 it is possible to use multi-event MIDI strings such as
176   two event CC messages, RPN or NRPN.
177 </p>
178
179 <p class="note">
180   The <code>sysex=</code> and <code>msg=</code> bindings will only work with
181   <code>function=</code> or <code>action=</code> control addresses. They
182   will <em>not</em> work with the <code>uri=</code> control addresses.
183   Controls used with <code>uri=</code> require a <em>Value</em> which is
184   only available in a known place with channel mode MIDI events.
185 </p>
186
187 <h4>Control address</h4>
188 <p>
189   A <dfn>control address</dfn> defines what the binding will actually control.
190   There are quite a few different things that can be specified here:
191 </p>
192 <p class="note">
193         Enable Feeback applies to these "Control Addresses" only.
194 </p>
195 <table class="dl">
196 <tr><th>/route/gain</th>
197 <td>the gain control ("fader") for the track/bus</td></tr>
198 <tr><th>/route/trim</th>
199 <td>the trim control for the track/bus (new in 4.1)</td></tr>
200 <tr><th>/route/solo</th>
201 <td>a toggleable control for solo (and listen) of the track/bus</td></tr>
202 <tr><th>/route/mute</th>
203 <td>a toggleable control to mute/unmute the track/bus</td></tr>
204 <tr><th>/route/recenable</th>
205 <td>a toggleable control to record-enable the track</td></tr>
206 <tr><th>/route/panwidth</th>
207 <td>interpreted by the track/bus panner, should control image "width"</td></tr>
208 <tr><th>/route/pandirection</th>
209 <td>interpreted by the track/bus panner, should control image "direction"</td></tr>
210 <tr><th>/route/plugin/parameter</th>
211 <td>the Mth parameter of the Nth plugin of a track/bus
212 </td></tr>
213 <tr><th>/route/send/gain</th>
214 <td>the gain control ("fader") of the Nth send of a track/bus</td></tr>
215 </table>
216 <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>
217 <table class="dl">
218 <tr><th>a number, e.g. "1"
219 </th>
220 <td>identifies a track or bus by its remote control ID
221 </td></tr>
222 <tr><th>B, followed by a number
223 </th>
224 <td>identifies a track or bus by its remote control ID within the current bank (see below for more on banks)
225 </td></tr>
226 <tr><th>S, followed by a number
227 </th>
228 <td>identifies a selected track in order they have been selected, S1 should be the same track as the Editor Mixer
229 </td></tr>
230 <tr><th>one or more words
231 </th>
232 <td>identifies a track or bus by its name
233 </td></tr>
234 </table>
235 <p>
236   For send/insert/plugin controls, the address consists of a track/bus
237   address (as just described) followed by a number identifying the plugin/send
238   (starting from 1). For plugin parameters, there is an additional third
239   component: a number identifying the plugin parameter number (starting from
240   1).
241 </p>
242 <p>
243   One additional feature: for solo and mute bindings, you can also add
244   <code>momentary="yes"</code> after the control address. This is useful
245   primarily for NoteOn bindings&mdash;when Ardour gets the NoteOn it
246   will solo or mute the targetted track or bus, but then when a NoteOff
247   arrives, it will un-solo or un-mute it.
248 </p>
249
250 <h4>Bindings to Ardour "functions"</h4>
251 <p class="note">
252         There is currently no feedback available for functions.
253 </p>
254 <p>
255   Rather than binding to a specific track/bus control, it may be useful to
256   have a MIDI controller able to alter some part of Ardour's state. A
257   binding definition that does this looks like this:
258 </p>
259 <code>
260   &lt;Binding channel="1" note="13" function="transport-roll"/&gt;
261 </code>
262 <p>
263   In this case, a NoteOn message for note number 13 (on channel 1) will
264   start the transport rolling. The following function names are available:
265 </p>
266 <table class="dl">
267 <tr><th>
268 <code>transport-stop</code>
269 </th>
270 <td>stop the transport
271 </td></tr>
272 <tr><th>
273 <code>transport-roll</code>
274 </th>
275 <td>start the transport "rolling"
276 </td></tr>
277 <tr><th>
278 <code>transport-zero</code>
279 </th>
280 <td>move the playhead to the zero position
281 </td></tr>
282 <tr><th>
283 <code>transport-start</code>
284 </th>
285 <td>move the playhead to the start marker
286 </td></tr>
287 <tr><th>
288 <code>transport-end</code>
289 </th>
290 <td>move the playhead to the end marker
291 </td></tr>
292 <tr><th>
293 <code>loop-toggle</code>
294 </th>
295 <td>turn on loop playback
296 </td></tr>
297 <tr><th>
298 <code>rec-enable</code>
299 </th>
300 <td>enable the global record button
301 </td></tr>
302 <tr><th>
303 <code>rec-disable</code>
304 </th>
305 <td>disable the global record button
306 </td></tr>
307 <tr><th>
308 <code>next-bank</code>
309 </th>
310 <td>Move track/bus mapping to the next bank (see Banks below)
311 </td></tr>
312 <tr><th>
313 <code>prev-bank</code>
314 </th>
315 <td>Move track/bus mapping to the previous bank (see Banks below)
316 </td></tr>
317 </table>
318
319 <h4>Binding to Ardour "actions"</h4>
320 <p class="note">
321         It is not possible to have feedback available for actions because
322         these represent keyboard shortcuts which are input only.
323 </p>
324 <p>
325   You can also bind a sysex or arbitrary message to any of the items
326   that occur in Ardour's main menu (and its submenus). The <a
327   href="@@list-of-menu-actions">
328   list of actions</a> shows all available values of <em>action-name</em>.
329 <p>
330   To create a binding between an arbitrary MIDI message (we'll use a
331   note-off on channel 1 of MIDI note 60 (hex) with release velocity
332   40 (hex)), the binding file would contain:
333 </p>
334 <code>
335    &lt;Binding msg="80 60 40" action="Editor/temporal-zoom-in"/&gt;
336 </code>
337 <p>
338   The general rule, when taken an item from the keybindings file and
339   using it in a MIDI binding is to simply strip the
340   <code>&lt;Action&gt;</code> prefix of the second field in the
341   keybinding definition.
342 </p>
343
344 <h3>Banks and Banking</h3>
345 <p>
346   Because many modern control surfaces offer per-track/bus controls
347   for far fewer tracks &amp; busses than many users want to control,
348   Ardour offers the relatively common place concept of <dfn>banks</dfn>. Banks
349   allow you to control any number of tracks and/or busses easily,
350   regardless of how many faders/knobs etc. your control surface has.<br>
351   To use banking, the control addresses must be specified using the
352   <dfn>bank relative</dfn> format mentioned above ("B1" to identify
353   the first track of a bank of tracks, rather than "1" to identify
354   the first track).
355 </p>
356 <p>
357   One very important extra piece of information is required to use
358   banking: an extra line near the start of the list of bindings
359   that specifies how many tracks/busses to use per bank. If the
360   device has 8 faders, then 8 would be a sensible value to use for
361   this. The line looks like this:</p>
362 <code>
363    &lt;DeviceInfo bank-size="8"/&gt;
364 </code>
365 <p>
366   In addition, you probably want to ensure that you bind something
367   on the control surface to the <code>next-bank</code> and
368   <code>prev-bank</code> functions, otherwise you and other users
369   will have to use the mouse and the GUI to change banks, which
370   rather defeats the purpose of the bindings.
371 </p>
372 <h3>The Selected Strip</h3>
373 <p>
374   Often times one wants to just deal with the strip currently
375   selected by the GUI (or the control surface). In the same way as with
376   banks above the selected strip can be designated with <em>S1</em>.
377 </p>
378 <h2>A Complete (though muddled) Example</h2>
379 <pre>
380 &lt;?xml version="1.0" encoding="UTF-8"?&gt;
381 &lt;ArdourMIDIBindings version="1.0.0" name="pc1600x transport controls"&gt;
382   &lt;DeviceInfo bank-size="16"/&gt;
383   &lt;Binding channel="1" ctl="1"   uri="/route/gain B1"/&gt;
384   &lt;Binding channel="1" ctl="2"   uri="/route/gain B2"/&gt;
385   &lt;Binding channel="1" ctl="3"   uri="/route/send/gain B1 1"/&gt;
386   &lt;Binding channel="1" ctl="4"   uri="/route/plugin/parameter B1 1 1"/&gt;
387   &lt;Binding channel="1" ctl="6"   uri="/bus/gain master"/&gt;
388
389   &lt;Binding channel="1" note="1"  uri="/route/solo B1"/&gt;
390   &lt;Binding channel="1" note="2"  uri="/route/solo B2" momentary="yes"/&gt;
391
392   &lt;Binding channel="1" note="15"  uri="/route/mute B1" momentary="yes"/&gt;
393   &lt;Binding channel="1" note="16"  uri="/route/mute B2" momentary="yes"/&gt;
394
395   &lt;Binding channel="1" enc-r="11"   uri="/route/pandirection B1"/&gt;
396   &lt;Binding channel="1" enc-r="12"   uri="/route/pandirection B2"/&gt;
397
398   &lt;Binding sysex="f0 0 0 e 9 0 5b f7" function="transport-start"/&gt;
399   &lt;Binding sysex="f0 7f 0 6 7 f7" function="rec-disable"/&gt;
400   &lt;Binding sysex="f0 7f 0 6 6 f7" function="rec-enable"/&gt;
401   &lt;Binding sysex="f0 0 0 e 9 0 53 0 0 f7" function="loop-toggle"/&gt;
402
403   &lt;Binding channel="1" note="13" function="transport-roll"/&gt;
404   &lt;Binding channel="1" note="14" function="transport-stop"/&gt;
405   &lt;Binding channel="1" note="12" function="transport-start"/&gt;
406   &lt;Binding channel="1" note="11" function="transport-zero"/&gt;
407   &lt;Binding channel="1" note="10" function="transport-end"/&gt;
408 &lt;/ArdourMIDIBindings&gt;
409 </pre>
410 <p>
411   Please note that channel, controller and note numbers are specified as
412   decimal numbers in the ranges 1-16, 0-127 and 0-127 respectively
413   (the channel range may change at some point).
414 </p>
415