Base class for audio source plugins
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
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
classdef myAudioSourcePlugin < audioPluginSource
myAudioSourcePluginis the name of your object.
audioPluginSource class is a
|getSamplesPerFrame||Get frame size returned by the plugin|
|setSamplesPerFrame||Set frame size returned by the plugin (MATLAB environment only)|
|getSampleRate||Get sample rate at which the plugin is run|
|setLatencyInSamples||Set latency in samples reported to DAW|
|setSampleRate||Set sample rate at which the plugin is run|
Design Valid Audio Plugin
Design a valid basic audio source plugin class
A valid audio source plugin is one that can be deployed in a digital audio workstation (DAW) environment. To validate it, use the
validateAudioPluginfunction. To generate it, use the
A basic audio source plugin inherits from the
audioPluginSourceclass but not the
Define a basic audio source plugin class that inherits from
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
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.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2016a