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