Skip to main content

Device Detection

Automatic device detection plays an important role in the MIDI Remote API, significantly improving user experience. By identifying and configuring MIDI controllers automatically, manual setup by the user becomes obsolete. This simplifies the connection process, allowing users to focus on their creative work without being hindered by technical tasks.

Detection Unit

Detection Units enable automatic detection and identification of MIDI devices, specifically MIDI input and output ports. They provide a structured way to define and execute the process of detecting these devices based on various criteria, such as port names and/or sysex identity responses. The goal is to simplify the configuration and setup process for MIDI devices by automating the detection process.

You can create a detection unit object using the previously created device driver object. This detection unit object serves as the starting point for defining the detection process.

Example:

var midiremote_api = require('midiremote_api_v1')

// create the device driver main object
var deviceDriver = midiremote_api.makeDeviceDriver('ExampleCompany', 'SimpleDevice', 'Steinberg Media Technologies GmbH')

const detectionUnit = deviceDriver.makeDetectionUnit()

Detecting a Port Pair

The detectPortPair method of the Detection Unit creates a link between a MIDI input and output port for bidirectional communication.

Example:

var midiInput = deviceDriver.mPorts.makeMidiInput()
var midiOutput = deviceDriver.mPorts.makeMidiOutput()

const portPair = detectionUnit.detectPortPair(inputPort, outputPort);

By Port Name

You can use various methods on a DetectionPortPair instance to specify expectations about the names of the input and output ports.

Example:

portPair.expectInputNameEquals('SimpleDevice IN');
portPair.expectOutputNameEquals('SimpleDevice OUT');

Other available methods include expectInputNameContains, expectInputNameStartsWith, expectInputNameEndsWith, expectOutputNameContains, expectOutputNameStartsWith, and expectOutputNameEndsWith.

By Sysex Identity Response

The expectSysexIdentityResponse method of DetectionPortPair allows you to expect a specific sysex identity response from the connected device. This can help in identifying devices that respond with specific manufacturer IDs, device families, and model numbers.

deviceDriver.makeDetectionUnit().detectPortPair(midiInput, midiOutput)
.expectSysexIdentityResponse('00206B', '0200', '0402')

Here the Arturia MiniLab mkII has been defined for detection.