Design an Audio Plugin
An audio plugin encapsulates an audio processing algorithm and enables you to tune the parameters of the algorithm while streaming audio.
Define an Audio Plugin
To define a plugin that enables users to adjust stereo width:
Create a class definition that inherits from
audioPlugin
.
参数化的立体声宽度加工基地gorithm by defining the public property
Width
.Enable users to tune the stereo width by defining an
audioPluginInterface
that containsWidth
as anaudioPluginParameter
.Define the audio processing by creating a
process
method. Theprocess
method takes the audio input,in
, and adjusts the stereo width by: (a) applying mid-side encoding, (b) adjusting the stereo width based on the user-controlledWidth
parameter, and then (c) applying mid-side decoding.
classdefStereoWidth < audioPlugin% <== (1) Inherit from audioPlugin.propertiesWidth = 1;% <== (2) Define tunable property.endproperties(Constant) PluginInterface = audioPluginInterface(...% <== (3) Map tunable property to plugin parameter.audioPluginParameter('Width',...'Mapping',{'pow',2,0,4}));endmethodsfunctionout = process(plugin,in)%< == (4) Define audio processing.x = [in(:,1) + in(:,2), in(:,1) - in(:,2)];% (a) Mid-side encoding.y = [x(:,1), x(:,2)*plugin.Width];% (b) Adjust stereo width.out = [(y(:,1) + y(:,2))/2, (y(:,1) - y(:,2))/2];% (c) Mid-side decoding.endendend
Prototype the Audio Plugin
Once you have defined an audio plugin, you can prototype it using theAudio Test Benchapp. TheAudio Test Benchapp enables you to stream audio through the plugin while you tune parameters, perform listening tests, and visualize the original and processed audio. To open yourStereoWidth
plugin in theAudio Test Benchapp, at the MATLAB® command prompt, enter:
audioTestBench(StereoWidth)
Validate and Generate a VST Plugin
You can validate a MATLAB® audio plugin and generate a VST plugin from theAudio Test Bench. You can also validate and generate the plugin from the command line by using thevalidateAudioPlugin
andgenerateAudioPlugin
functions. Once generated, you can deploy your plugin to a digital audio workstation (DAW).
validateAudioPluginStereoWidthgenerateAudioPluginStereoWidth
The VST plugin is saved to your working directory.
See Also
audioPlugin
|audioPluginSource
|audioPluginGridLayout
|audioPluginInterface
|audioPluginParameter
|generateAudioPlugin
|validateAudioPlugin
|Audio Test Bench