Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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

Methods

getSamplesPerFrameGet frame size returned by the plugin
setSamplesPerFrameSet frame size returned by the plugin (MATLAB environment only)

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.

Examples

expand 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™.

Introduced in R2016a

Was this topic helpful?