MATLAB Answers

how to build audio vst plugin using external functions?

8 views (last 30 days)
I saw some examples of audio plugin generation, but I want to use my own custom functions in .m files. For example, I am not using Matlab's own spectrogram function, but my own spectrogram function and I will need it, along with the Inverse STFT function I have to generate a plugin. My question is how is this done with the audio plugin class? How do I add or call these external functions so that I can use them and will they be packaged together when it comes to the generation of VST phase?
Also, what if my VST plugin is not real-time. I want to create a plugin where when it loads, the user clicks a button called process and then a waitbar appears until process is done and then the input signal is modified by this process.
Can someone show me a snippet of code or something, just to get me started.


Sign in to comment.

Accepted Answer

Gabriele Bunkheila
Gabriele Bunkheila on 30 Apr 2018
Hi John,
This is fairly straightforward. If you wanted to use your own legacy code to process the actual audio samples, just call your existing function(s) from within the process method of your new audioPlugin class. All you need to ensure is that your code is packaged at least as a function and it is on the MATLAB path .
Since you asked for a practical example, consider the code at page 3 of this paper. In this case, the MATLAB plugin relies on an separate function (i.e. highPassCoeffs.m) to compute the coefficients of a highpass filter. Here that function is called from within the set method of the property Fc, so it is invoked every time the cutoff frequency of the filter is changed by the user.
In terms of the non real-time processing, that is mainly the responsibility of the VST host application. For example, from within your DAW you will select the relevant audio segment, then trigger the right workflow for batch processing (sometimes called "render"). The VST plugins generated from MATLAB with Audio System Toolbox are indeed also compatible with that use.
I hope this is at least enough to get you started.

More Answers (0)