This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Return most recent value of MIDI controls

The midiread function will be removed from DSP System Toolbox™ in a future release. Existing instances of the function continue to run. For new code, use the midiread function from Audio System Toolbox™ instead.




v = midiread(h) returns the most recent value of the MIDI controls associated with midicontrols object, h. You must create h first before it can determine the values of its MIDI controls if they are moved. Calling midiread before the controls are moved, returns the initial values specified to midicontrols. In this case, when h is created. (or 0 if no initial values are specified).


collapse all

h = midicontrols;
v = midiread(h);

Input Arguments

collapse all

h is an object that listens to the controls on a MIDI device.

Output Arguments

collapse all

The output value depends on the OutputMode specified by midicontrols when h is created. If you specify that the OutputMode is normalized, then the midiread returns output values in the range [0 1]. Also, initial values are quantized and may be slightly different from those specified by midicontrols.

If you specify the mode as rawmidi, then midiread returns integer values in the range [0 127], and no quantization is required. If you do not specify the OutputMode, the default is normalized.

Example: 0.3 or [0 0.3 0.6]

Data Types: double | uint8

Introduced in R2013b

Was this topic helpful?