Main Content

MIDI Controls

Output values from controls on MIDI control surface

  • MIDI Controls block

Libraries:
Audio Toolbox / Sources
DSP System Toolbox / Sources

Description

The MIDI Controls block outputs values from controls on a MIDI control surface in real time. Use the MIDI Controls block to interact with your audio processing model.

The MIDI Controls block combines the functionality of the general MIDI functions in MATLAB®: midicontrols, midiread, midisync. Use the MATLAB midiid command to discover MIDI device names or MIDI device control numbers.

Ports

Output

expand all

The output size of the MIDI Controls block is determined by the MIDI controls and MIDI control numbers parameters.

The output data type is determined by the Output mode parameter.

Data TypeOutput Mode
doubleNormalized (0-1)
uint8RAW MIDI (0-127)

Data Types: double | uint8

Parameters

expand all

To set the default MIDI device, use the setpref function. For example, if the device is named BCF2000, at the MATLAB command line, enter:

setpref('midi','DefaultDevice','BCF2000');

The MIDI device name is assigned by the device manufacturer or host operating system, and specified as a character vector. Use midiid to interactively identify your MIDI device.

To enable this parameter, set MIDI device to Specify other.

This parameter also determines the size of the block output port. If you choose Respond to any control, then the block output is a scalar corresponding to the value of the most recently manipulated control.

Use midiid to interactively identify the control numbers of your MIDI device. This parameter is available when you set MIDI controls to Respond to specified controls.

If you specify Initial values as a scalar, all controls specified by MIDI control numbers are assigned that value.

If you specify Initial values as an array, the array must be the same size as MIDI control numbers.

Select this parameter to synchronize a MIDI device with values specified by the Initial values when simulation starts. If your MIDI device can receive and respond to messages, it adjusts its controls as specified. This parameter is valid only when MIDI controls is set to Respond to specified controls.

Many MIDI devices are not bidirectional. Selecting this parameter with a unidirectional device has no effect. The MIDI Controls block cannot tell whether a value is successfully sent to a device or even whether the device is bidirectional. If sending a value fails, no errors or warnings are generated.

Output mode for MIDI control value, specified as Normalized (0-1) or RAW MIDI (0-127).

Block Characteristics

Data Types

double | integer

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Tips

  • The MIDI Controls block is not supported for rapid accelerator mode.

Extended Capabilities