Export a MATLAB Plugin to a DAW
Audio Toolbox™ enables generation of VST plugins from MATLAB® source code by using the
generateAudioPlugin function. The generated plugin is compatible with
32-bit and 64-bit Windows, and 64-bit Mac host applications. After you generate a VST
plugin, you can use your generated audio plugin in a digital audio workstation
Plugin Development Workflow
Design an audio plugin. For a tutorial on audio plugin architecture and design in the MATLAB environment, See Audio Plugins in MATLAB.
Validate your audio plugin using the
Test your audio plugin using Audio Test Bench.
Generate your audio plugin using the
Use your generated audio plugin in a DAW.
Considerations When Generating Audio Plugins
Your plugin must be compatible with MATLAB code generation. See MATLAB Programming for Code Generation (MATLAB Coder) for more information.
Your generated plugin must be compatible with DAW environments. The DAW environment:
Determines the sample rate and frame size at which a plugin is run, both of which are variable.
Calls the reset function of your plugin at the beginning of each use and if the sample rate changes.
Requires a consistent input and output frame size for the plugin processing function.
Must be synchronized with plugin parameters. Therefore, a plugin must not modify properties associated with parameters.
Requires that plugin properties associated with parameters are scalar values.
Test Bench, and
to guide your audio plugin into a valid form capable of generation.
How Audio Plugins Interact with the DAW Environment
After you generate your plugin, plug it into a DAW environment. See documentation on your specific DAW for details on adding plugins.
The audio plugin in the DAW environment interacts primarily through the processing function, reset function, and interface properties of your plugin.
Initialization and Reset
The DAW environment calls the reset function of the plugin the first time the plugin is used, or any time the sample rate of the DAW environment is modified. You can use the
getSampleRatefunction to query the sample rate of the environment.
The DAW environment passes a frame of an audio signal to the plugin. The DAW determines the frame size. If the audio plugin is a source audio plugin, the DAW does not pass an input audio signal.
The processing function of your plugin performs the frame-based audio processing algorithm you specified, and updates internal plugin properties as needed. Plugins must not write to properties associated with parameters.
The processing function of your plugin passes the processed audio signal out to the DAW environment. The frame size of the output signal must match the frame size of the input signal. If the audio plugin is a source audio plugin, you must use
getSamplesPerFrameto determine the output frame size. Because the environment frame rate is variable, you must call
getSamplesPerFramefor each output frame.
Processing is performed iteratively frame by frame on an audio signal.
If you modify a parameter through the plugin dialog box, the synchronized public property updates at that time. You can use the
setmethod of MATLAB classes to modify private properties.