Main Content

externalAudioPlugin class

Base class for external audio plugins


externalAudioPlugin is the base class for hosted audio plugins. When you load an external plugin using loadAudioPlugin, an object of that plugin is created having externalAudioPlugin or externalAudioPluginSource as a base class. The externalAudioPluginSource class is used when the external audio plugin is a source plugin.

For a tutorial on hosting audio plugins, see Host External Audio Plugins.


dispParameterDisplay information of single or multiple parameters
getParameterGet normalized value and information about parameter
infoGet information about hosted plugin
processProcess audio stream
setParameterSet normalized parameter value of hosted plugin

Inherited Methods

getSampleRateGet sample rate at which the plugin is run
setLatencyInSamplesSet latency in samples reported to DAW
setSampleRateSet sample rate at which the plugin is run

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Object Behavior.


collapse all

Load a VST audio plugin into MATLAB® by specifying its full path. If you are using a Mac, replace the .dll file extension with .vst.

pluginPath = fullfile(matlabroot,'toolbox/audio/samples/ParametricEqualizer.dll');
hostedPlugin = loadAudioPlugin(pluginPath)

Use info to return information about the hosted plugin.


Use setParameter to change the normalized value of the Medium Center Frequency parameter to 0.75. Specify the parameter by its index.


When you set the normalized parameter value, the parameter display value is automatically updated. The normalized parameter value generally corresponds to the position of a UI widget or MIDI controller. The parameter display value typically reflects the value used internally for processing.

Use dispParameter to display the updated table of parameters.


Alternatively, you can use getParameter to return the normalized value of a single parameter.

parameterIndex = 5;
parameterValue = getParameter(hostedPlugin,parameterIndex)

Load a VST audio plugin into MATLAB™ by specifying its full path. If you are using a Mac, replace the .dll file extension with .vst.

pluginPath = fullfile(matlabroot,'toolbox','audio','samples','ParametricEqualizer.dll');
hostedPlugin = loadAudioPlugin(pluginPath);

Create input and output objects for an audio stream loop that reads from a file and writes to your audio device. Set the sample rate of the hosted plugin to the sample rate of the input to the plugin.

fileReader = dsp.AudioFileReader('FunkyDrums-44p1-stereo-25secs.mp3');
deviceWriter = audioDeviceWriter('SampleRate',fileReader.SampleRate);

Set the MediumPeakGain property to -20 dB.

hostedPlugin.MediumPeakGain = -20;

Use the hosted plugin to process the audio file in an audio stream loop. Sweep the medium peak gain upward in the loop to hear the effect.

while hostedPlugin.MediumPeakGain < 19
    hostedPlugin.MediumPeakGain = hostedPlugin.MediumPeakGain + 0.04;
    x = fileReader();
    y = process(hostedPlugin,x);

Introduced in R2016b