design an audio plugin -凯发k8网页登录
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
.
parameterize the stereo width of the processing algorithm by defining the public property
width
.enable users to tune the stereo width by defining an that contains
width
as an .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.
classdef stereowidth < audioplugin % <== (1) inherit from audioplugin. properties width = 1; % <== (2) define tunable property. end properties (constant) plugininterface = audioplugininterface( ... % <== (3) map tunable property to plugin parameter. audiopluginparameter('width', ... 'mapping',{'pow',2,0,4})); end methods function out = 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. end end end
prototype the audio plugin
once you have defined an audio plugin, you can prototype it using the app. the audio test bench app enables you to stream audio through the plugin while you tune parameters, perform listening tests, and visualize the original and processed audio. to open your stereowidth
plugin in the audio test bench app, 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 the audio test bench. you can also validate and generate the plugin from the command line by using the and functions. once generated, you can deploy your plugin to a digital audio workstation (daw).
validateaudioplugin stereowidth
checking plugin class 'stereowidth'...
passed. generating testbench file 'testbench_stereowidth.m'... done. running testbench... passed. generating mex file 'testbench_stereowidth_mex.mexw64'... done. running mex testbench... passed. deleting testbench. ready to generate audio plugin.
generateaudioplugin stereowidth
.......
the vst plugin is saved to your working directory.
see also
| | | | | | |