Bitwig Studio Tutorial 2:
Autodetect Controllers

Bitwigs Controller API can auto-detect Devices based on the names of their USB connections.
So instead of selecting your Devices from the manual dropdown, you just press the auto-detection button in Preferences and your Controllers get added to the list and connected to the correct USB ports.

In the first Tutorial, we created the Acme Keyboard Script.
We changed some stuff in the first two lines to make the Script show the real name of a device instead of the generic one.

EDIT: Please be aware that this tutorial was created for Bitwig Studio 1.0 in 2014. While it should still work, it no longer represents the latest state of the Bitwig API, so please refer to the most current documentation!

Now we need to add a third line below those two:

host.defineController("Akai", "MPD18", "1.0", "E5C26D00-40A6-11E3-AA6E-0800200C9A66");
host.defineMidiPorts(1, 1);
host.addDeviceNameBasedDiscoveryPair(["Akai MPD18"], ["Akai MPD18"]);

As you can see, this time I use my AKAI MPD 18 Script as an example, since in this case we need to work with real world Names.

What this additional line does, is simply looking at the names of Midi Devices on your machine: if Names match what is given in the Discovery Pair, it can automagically connect devices with the correct ports if you press “Detect available controllers” in the Preferences/Controllers Tab.

Instead of “Akai MPD18” you need to insert the EXACT names of YOUR Midi Input Device in the first brackets and of the Midi Output Device in the second brackets.

Here is my AKAI MPD18 Script for reference:
Toms MPD18 Controller Script for Bitwig

The discovery pair is actually two arrays, so if your controller has multiple inputs, you use it like this:

host.defineController("Novation", "Launchkey Mini", "1.0", "6a0b6a50-26fa-11e4-8c21-0800200c9a66");
host.defineMidiPorts(2, 2);
host.addDeviceNameBasedDiscoveryPair(["Launchkey Mini", "MIDIIN2 (Launchkey Mini)"], ["Launchkey Mini", "MIDIOUT2 (Launchkey Mini)"]);

Make sure to check the names on OSX and Linux too. In some cases they are identical on OSX while Linux usually appends ” MIDI 1″ to the name, in other cases they are completely different between platforms.

And finally: you can basically have as many discovery-pair-lines as you want. The first match is used by the script. This can be helpful if several controllers are attached and the OS adds numbers to the names.

Of course this only works for USB connected devices usually, since they show the name of the actual device.
Most Midi-connected Devices only show the Name of the Interface they are connected to, and that doesn’t make much sense to use for autodetection.

There are more involved solutions even for that scenario (using SysEx identification sequences) but if you want to go down that road, it makes more sense you read the Control Surface API GUIDE in the docs that come with Bitwig Studio. ;-)

I hope this was helpful and wish you a lot of fun with Bitwig Studio!



Continue with Part 3 here

Posted in Audio, English, General, Tutorials | Tagged , , , , , , | 2 Comments

2 Responses to Bitwig Studio Tutorial 2:
Autodetect Controllers

  1. Mark White says:

    Hi Thomas,

    I’ve logged a bug with the Bitwig team around the fact that your Keylab scripts no longer work in Bitwig v2.2. It’s not your scripts that are the problem… it looks as though the Bitwig team have hard-coded a controller driver into Bitwig – and the new code doesn’t work correctly with my Keylab 88.

    The reason I’m reaching out to you is that your Github scripts can be easily modified to work again in Bitwig 2.2 … you simply need to eliminate the use of deconstruction assignments, which you tend to use when, for example, calling getEnvolopeName and then sending the resulting strings to SendTextToKeylab.

    I am happy to contribute to your GitHub repository, or alternately you can apply the workaround yourself. Let me know?

Leave a Reply

Your email address will not be published. Required fields are marked *