Create Vst Plugins In Matlab
Stereo Convolution Reverb (VST audio plugin). Learn more about dsp, vst, audio plugin, convolution Audio Toolbox, DSP System Toolbox.
Create Custom Plugin
This example shows how to create a custom plugin that counts the number of passing and failing assertions when the TestRunner
is running a test suite. The plugin prints a brief summary at the end of the testing. To extend the TestRunner
, the plugin subclasses and overrides select methods of the matlab.unittest.plugins.TestRunnerPlugin
class.
Create a simple audio plugin in MATLAB and then use it to generate a VST plugin. Audio Plugins in MATLAB. Learn about the role, definition, and design of audio plugins in Audio Toolbox. Design User Interface for Audio Plugin. Define custom graphical user interfaces for audio plugins. Convert MATLAB Code to an Audio Plugin. A VST 2 audio effect plugin written in MATLAB that uses a genetic algorithm to generate a random impulse response describing the reverberation of an artificial room, and uses the impulse response to apply convolution reverb to an audio signal in real-time.
Create AssertionCountingPlugin Class
In a file in your current folder, create the custom plugin class AssertionCountingPlugin
, which inherits from the TestRunnerPlugin
class. For the complete code for AssertionCountingPlugin
, see AssertionCountingPlugin Class Definition Summary.
To keep track of the number of passing and failing assertions, define two read-only properties, NumPassingAssertions
and NumFailingAssertions
, within a properties
block.
Extend Running of TestSuite
Implement the runTestSuite
method in a methods
block with protected
access.
The testing framework evaluates this method one time. It displays information about the total number of tests, initializes the properties used by the plugin to generate text output, and invokes the superclass method. After the framework completes evaluating the superclass method, the runTestSuite
method displays the assertion count summary by calling the helper method printAssertionSummary
(see Define Helper Methods).
Extend Creation of Shared Test Fixtures and TestCase Instances
Add listeners to AssertionPassed
and AssertionFailed
events to count the assertions. To add these listeners, extend the methods used by the testing framework to create the test content. The test content includes TestCase
instances for each Test
element, class-level TestCase
instances for the TestClassSetup
and TestClassTeardown
methods, and Fixture
instances used when a TestCase
class has the SharedTestFixtures
attribute.
Invoke the corresponding superclass method when you override the creation methods. The creation methods return the content that the testing framework creates for each of their respective contexts. When implementing one of these methods using the incrementPassingAssertionsCount
and incrementFailingAssertionsCount
helper methods, add the listeners required by the plugin to the returned Fixture
or TestCase
instance.
Add these creation methods to a methods
block with protected
access.
Extend Running of Single Test Suite Element
Extend runTest
to display the name of each test at run time. Include this method in a methods
block with protected
access. Like all plugin methods, the runTest
method requires you to invoke the corresponding superclass method.
Define Helper Methods
In a methods
block with private
access, define three helper methods. These methods increment the number of passing or failing assertions, and print the assertion count summary.
AssertionCountingPlugin Class Definition Summary
The following code provides the complete contents of AssertionCountingPlugin
.
Create Example Test Class
In your current folder, create a file named ExampleTest.m
containing the following test class.
Add Plugin to TestRunner and Run Tests
At the command prompt, create a test suite from the ExampleTest
class.
Create a TestRunner
instance with no plugins. This code creates a silent runner and gives you control over the installed plugins.
Run the tests.
Add AssertionCountingPlugin
to the runner and run the tests.
See Also
addlistener
| matlab.unittest.fixtures.Fixture
| matlab.unittest.plugins.OutputStream
| matlab.unittest.plugins.TestRunnerPlugin
| matlab.unittest.TestCase
| matlab.unittest.TestRunner
Related Topics
Base class for external audio source plugins
Description
externalAudioPluginSource
is the base classfor hosted audio source plugins. When you load an external pluginusing loadAudioPlugin
, an objectof that plugin is created having externalAudioPlugin
or externalAudioPluginSource
asa base class. The externalAudioPluginSource
classis used when the external audio plugin is a source plugin.

For a tutorial on hosting audio plugins, see Host External Audio Plugins.
Methods
Inherited Methods
dispParameter | Display information of single or multiple parameters |
getParameter | Get normalized value and information about parameter |
info | Get information about hosted plugin |
process | Process audio stream |
setParameter | Set normalized parameter value of hosted plugin |
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 |
getSamplesPerFrame | Get frame size returned by the plugin |
setSamplesPerFrame | Set frame size returned by the plugin (MATLAB environment only) |
Copy Semantics
Handle. To learn how handle classes affect copy operations,see Object Behavior.
Examples
Load a VST audio source plugin into MATLAB® by specifying its full path. If you are using a Mac, replace the .dll
file extension with .vst
.
Use info
to return information about the hosted plugin.
Use setParameter
to change the normalized value of the Frequency
parameter to 0.8. Specify the parameter by its index.
When you set the normalized parameter value, the parameter display value is automatically updated. Generally, the normalized parameter value corresponds to the position of a UI widget or MIDI controller. The parameter display value typically reflects the value used internally by the plugin 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.
Create Vst Plugins In Matlab Tutorial
Load a VST audio source plugin into MATLAB™ by specifying its full path. If you are using a Mac, replace the .dll
file extension with .vst
.
Set the Amplitude
property to 0.5. Set the Frequency
property to 16 kHz.
Set the sample rate at which to run the plugin. Create an output object to write to your audio device.
Use the hosted source plugin to output an audio stream. The processing in the audio stream loop ramps the frequency parameter down and then up.

See Also
Audio Test Bench | audioPlugin
| audioPluginSource
| externalAudioPlugin
| loadAudioPlugin
| parameterTuner