Main Content

Generate Standalone Executable for Parametric Audio Equalizer

This example shows how to generate a standalone executable for parametric equalization using MATLAB Coder™ and use it on an audio file. multibandParametricEQ is used for the equalization algorithm. The example allows you to dynamically adjust the coefficients of the filters using a user interface (UI) that is running in MATLAB.

Introduction

multibandParametricEQ allows up to ten equalizer bands in cascade. In this example, you create an equalizer with three bands. Each of the three biquad filters allows three parameters to be tuned: center frequency, Q factor, and the peak (or dip) gain.

audioEqualizerEXEExampleApp creates a UI to tune filter parameters and plot the magnitude response of the equalizer. HelperEqualizerEXEProcessing> iteratively reads audio from a file, applies the 3-band parametric equalization algorithm on it, and plays the output of the equalization. Anytime during the simulation, it can also respond to the changes in the sliders of the MATLAB UI. This section goes into the standalone executable.

Generating Code and Building an Executable File

You can use MATLAB Coder to generate readable and standalone C-code from the parametric equalizer algorithm code. Because the algorithm code uses System objects for reading and playing audio files, there are additional dependencies for the generated code and executable file. These are available in the /bin directory of your MATLAB installation.

Run HelperAudioEqualizerGenerateEXE to invoke MATLAB Coder to automatically generate C-code and a standalone executable from the algorithm code present in HelperEqualizerEXEProcessing.

Running the example

Once you have generated the executable, run audioEqualizerEXEExampleApp to launch the executable and a user interface (UI) designed to interact with the simulation. The UI allows you to tune parameters and the results are reflected in the simulation instantly. For example, moving the slider for the 'Center Frequency1' to the right while the simulation is running increases the center frequency of the first parametric equalizer biquad filter. You can verify this by noticing the change immediately in the magnitude response plot.