midi control for audio plugins -凯发k8网页登录

main content

midi control for audio plugins

midi and plugins

midi control surfaces are commonly used in conjunction with audio plugins in digital audio workstation (daw) environments. synchronizing midi controls with plugin parameters provides a tangible interface for audio processing and is an efficient approach to parameter tuning.

in the matlab® environment, audio plugins are defined as any valid class that derives from the audioplugin base class or the audiopluginsource base class. for more information about how audio plugins are defined in the matlab environment, see .

use midi with matlab plugins

the audio toolbox™ product provides three functions for enabling the interface between midi control surfaces and audio plugins:

  • –– configure midi connections between audio plugin and midi controller.

  • –– get midi connections of audio plugin.

  • –– disconnect midi controls from audio plugin.

these functions combine the abilities of general midi functions into a streamlined and user-friendly interface suited to audio plugins in matlab. for a tutorial on the general functions and the midi protocol, see .

this tutorial walks you through the midi functions for audio plugins in matlab.

1. connect midi device and then start matlab

before starting matlab, connect your midi control surface to your computer and turn it on. for connection instructions, see the instructions for your midi device. if you start matlab before connecting your device, matlab might not recognize your device when you connect it. to correct the problem, restart matlab with the device already connected.

2. establish midi connections

use configuremidi to establish midi connections between your default midi device and an audio plugin. you can use configuremidi programmatically, or you can open a user interface (ui) to guide you through the process. the configuremidi ui reads from your audio plugin and populates a drop-down list of tunable plugin properties. you are then prompted to move individual controls on your midi control surface to associate the position of each control with the normalized value of each property you select. for example, create an object of audiopluginexample.pitchshifter and then call configuremidi with the object as the argument:

ctrlpitch = audiopluginexample.pitchshifter;
configuremidi(ctrlpitch)

the synchronize to midi controls dialog box opens with the tunable properties of your plugin automatically populated. when you select a property and operate a midi control, its identification is entered into the midi control column. after you synchronize tunable properties with midi controls, click ok to complete the configuration. if your midi control surface is bidirectional, it automatically shifts the position of the synchronized controls to the initial property values specified by your plugin.

to open a matlab function with the programmatic equivalent of your actions in the ui, select the generate matlab code check box. saving this function enables you to reuse your settings and quickly establish the configuration in future sessions.

3. tune plugin parameters using midi

after you establish connections between plugin properties and midi controls, you can tune the properties in real time using your midi control surface.

audio toolbox provides an all-in-one app for running and testing your audio plugin. the test bench mimics how a daw interacts with plugins.

open the audio test bench for your ctrlpitch object.

audiotestbench(ctrlpitch)

when you adjust the controls on your midi surface, the corresponding plugin parameter dials move. click to run the plugin. move the controls on your midi surface to hear the effect of tuning the plugin parameters.

to establish midi connections and modify existing ones, click the synchronize to midi controls button to open a configuremidi ui.

alternatively, you can use the midi connections you established in a script or function. for example, run the following code and move your synchronized midi controls to hear the pitch-shifting effect:

filereader = dsp.audiofilereader(...
    'filename','counting-16-44p1-mono-15secs.wav');
devicewriter = audiodevicewriter;
% audio stream loop
while ~isdone(filereader)
    input = filereader();
    output = ctrlpitch(input);
    devicewriter(output);
    drawnow limitrate; % process callback immediately
end
release(filereader);
release(devicewriter);

4. get current midi connections

to query the midi connections established with your audio plugin, use the getmidiconnections function. getmidiconnections returns a structure with fields corresponding to the tunable properties of your plugin. the corresponding values are nested structures containing information about the mapping between your plugin property and the specified midi control.

connectioninfo = getmidiconnections(ctrlpitch)
connectioninfo = 
  struct with fields:
    pitchshift: [1×1 struct]
       overlap: [1×1 struct]
connectioninfo.pitchshift
ans = 
  struct with fields:
            law: 'int'
            min: -12
            max: 12
    midicontrol: 'control 1081 on 'bcf2000''

5. disconnect midi surface

as a best practice, release external devices such as midi control surfaces when you are done.

disconnectmidi(ctrlpitch)

see also

apps

classes

  • |

functions

  • | |

related topics

external websites

    网站地图