This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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
setSampleRateSet sample rate at which the plugin is run

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Object Behavior (MATLAB) in the MATLAB® documentation.


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)
hostedPlugin = 

  VST plugin 'ParametricEQ'  2 in, 2 out

              LowPeakGain: 0 dB
       LowCenterFrequency: 100 Hz
               LowQFactor: 2
           MediumPeakGain: 0 dB
    MediumCenterFrequency: 1000 Hz
            MediumQFactor: 2
             HighPeakGain: 0 dB
      HighCenterFrequency: 10000 Hz
              HighQFactor: 2

Use info to return information about the hosted plugin.

ans = 

  struct with fields:

        PluginName: 'ParametricEQ'
            Format: 'VST'
     InputChannels: 2
    OutputChannels: 2
         NumParams: 9
        PluginPath: 'E:\jobarchive\Bdsp\2018_07_19_h20m03s12_job916096_pass\matlab\toolbox\audio\samples\ParametricEqualizer.dll'
        VendorName: ''
     VendorVersion: 'V1.0.0'
          UniqueId: 'MWap'

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.

                       Parameter    Value    Display
     1             Low Peak Gain:   0.5000      0.000 dB
     2      Low Center Frequency:   0.2330    100.000 Hz
     3              Low Q Factor:   0.2822      2.000   
     4          Medium Peak Gain:   0.5000      0.000 dB
     5   Medium Center Frequency:   0.7500   3556.559 Hz
     6           Medium Q Factor:   0.2822      2.000   
     7            High Peak Gain:   0.5000      0.000 dB
     8     High Center Frequency:   0.8997   9999.999 Hz
     9             High Q Factor:   0.2822      2.000   

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

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


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 = ...
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