Audio Phaser Using Multiband Parametric Equalizer
This example shows how to implement a real-time audio "phaser" effect which can be tuned by a user interface (UI). It also shows how to generate a VST plugin for the phaser that you can import into a Digital Audio Workstation (DAW).
The phaser is an audio effect produced when an audio signal is passed through one or more notch filters. The center frequencies of the notch filters are typically modulated at some consistent rate to produce a "swirling" effect on the audio. The modulation source is typically a low frequency oscillator such as a sine wave. Different waveform shapes create different phaser effects.
You can use any audio file with this example. However, the phasing effect is more audible with some audio files than with others. A file that is suggested for this example is
RockGuitar-16-44p1-stereo-72secs.wav. Another option is to use a pink noise source instead of a file.
This example uses the
audiopluginexample.Phaser audio plugin class. The plugin implements a multi-notch filter with notch frequencies modulated by an
audioOscillator. The multi-notch filter is implemented through the
multibandParametricEQ System object. The bands of the equalizer can be made to act as individual notch filters by setting their gain to
Test the Phaser
You can test the phaser implemented in
audiopluginexample.Phaser using Audio Test Bench. The audio test bench sets up the audio file reader and audio device writer objects, and streams the audio through the phaser in a processing loop.
Initialize the phaser and visualize its magnitude response.
phaser = audiopluginexample.Phaser; visualize(phaser)
Launch the Audio Test Bench.
The Audio Test Bench enables you to tune the audio phaser using sliders and drop-down menus. Changing slider or drop-down values updates the magnitude response plot of the phaser in real time.
The four sliders are:
Rate - Controls the rate at which the center frequency of the notch filters sweep up and down the audio spectrum.
Center Frequency - Controls the center frequency of the lowest notch. The center frequency of other notches is calculated relative to this value and the modulation source.
Depth - Controls how far the notch frequencies modulate around the center frequency.
Qualify Factor - Sets the quality factor (or "Q") of each notch. A higher Q setting creates a narrower bandwidth notch.
There are also two drop-down menus:
Notches - Sets the number of notch filters. More notches can be used to create a more dramatic effect.
Modulation Source - The waveform that controls the center frequencies of the notch filters. Different waveforms create different sweep sounds.
The audio test bench by default streams audio from a file on disk. You can change it to a sound card microphone/line-in input, or pink noise (useful for testing).
Click the Run button on the UI to start streaming and hear the phaser effect.
Run as VST Plugin
You may find that audio dropouts occur when using higher numbers of notches or high Rate settings. One way to work around this is to generate a VST plugin to take the place of the portion of the code that performs the actual audio processing. Switch the Run As drop-down to VST Plugin. On running the simulation now, a VST plugin will be generated and loaded back into MATLAB for use in the simulation.
Generate Audio Plugin
To generate and port a VST plugin to a Digital Audio Workstation, click on the Generate VST 2 Audio Plugin button on the toolbar of audio test bench, or run the