Main Content

audioPluginSource Class

Base class for audio source plugins

Description

audioPluginSource is the base class for audio source plugins. Use audio source plugins to produce audio signals.

To create a valid audio source plugin, in your class definition file, subclass your object from the audioPluginSource class. Subclassing enables you to inherit the attributes necessary to generate audio source plugins and access Audio Toolbox™ functionality. To inherit from the audioPluginSource base class directly, type this syntax as the first line of your class definition file:

classdef myAudioSourcePlugin < audioPluginSource
myAudioSourcePlugin is the name of your object.

The audioPluginSource class is a handle class.

Methods

expand all

Examples

collapse all

Design a valid basic audio source plugin class

Terminology:

  • A valid audio source plugin is one that can be deployed in a digital audio workstation (DAW) environment. To validate it, use the validateAudioPlugin function. To generate it, use the generateAudioPlugin function.

  • A basic audio source plugin inherits from the audioPluginSource class but not the matlab.System class.

Define a basic audio source plugin class that inherits from audioPluginSource.

classdef myAudioSourcePlugin < audioPluginSource 
end

Add a processing function to your audio source plugin class.

All valid audio source plugins include a processing function. For basic audio source plugins, the processing function is named process. The processing function defines the audio signal that your plugin outputs. Audio source plugins do not accept audio signals as input to the processing function.

The default audio plugin interface assumes a stereo output. Specify the processing output as a matrix with two columns. These columns correspond to the left and right channels of a stereo signal. The number of rows in the output matrix correspond to the frame size.

The output frame size must match the frame size of the environment in which the plugin is run. A DAW environment has variable frame size. To determine the current environment frame size, call getSamplesPerFrame in the process function.

classdef myAudioSourcePlugin < audioPluginSource
    methods
        function out = process(plugin)
            out = 0.5*randn(getSamplesPerFrame(plugin),2);
        end
    end  
end

myAudioSourcePlugin generates a Gaussian white noise audio signal with 0.5 standard deviation.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2016a