Configure MIDI connections between audio object and MIDI controller
configureMIDI(
opens a MIDI
configuration user interface (UI). Use the UI to synchronize parameters of the
plugin, audioObject
)audioObject
, to MIDI controls on your default MIDI
device. You can also generate MATLAB® code corresponding to the MIDI configuration developed using the
configureMIDI
UI.
To set your default device, type this syntax in the command line:
setpref midi DefaultDevice deviceNameValue
deviceNameValue
is the MIDI device name, assigned by the device
manufacturer or host operating system. Use midiid
to get the device name
corresponding to your MIDI device.
configureMIDI(
makes the property, audioObject
,propertyName
)propertyName
, respond to any control on the
default MIDI device.
configureMIDI(
makes the property respond to the MIDI control specified by
audioObject
,propertyName
,controlNumber
)controlNumber
.
configureMIDI(
makes the property respond to the MIDI control specified by
audioObject
,propertyName
,controlNumber
,'DeviceName',deviceNameValue
)controlNumber
on the device specified by
deviceNameValue
.
For MIDI connections established by configureMIDI
, moving a MIDI control
sends a callback to update the associated property values. To synchronize your MIDI
device in an audio stream loop, you might need to use the drawnow
command for the callback to process immediately. For efficiency,
use the drawnow limitrate
syntax.
For example, to synchronize your MIDI device and audio object, uncomment the drawnow
limitrate
command from this
code:
fileReader = dsp.AudioFileReader('Filename','RockDrums-44p1-stereo-11secs.mp3'); deviceWriter = audioDeviceWriter; dRC = compressor; configureMIDI(compressor,'Threshold') while ~isDone(fileReader) input = fileReader(); output = dRC(input); deviceWriter(output); % drawnow limitrate; end release(fileReader); release(deviceWriter);
If your audio stream loop includes visualizing data on a scope,
such as dsp.SpectrumAnalyzer
, timescope
, or dsp.ArrayPlot
, the drawnow
command
is not required.
audioPlugin
| disconnectMIDI
| getMIDIConnections
| midicallback
| midicontrols
| midiid
| midiread
| midisync