Tunable Filtering and Visualization Using Audio Plugins
This example shows how to visualize the magnitude response of a tunable filter. The filters in this example are implemented as audio plugins. This example uses the visualize
and audioTestBench
functionality of the Audio Toolbox™.
Tunable Filter Examples
Audio Toolbox provides several examples of tunable filters that have been implemented as audio plugins:
audiopluginexample.BandpassIIRFilter
audiopluginexample.HighpassIIRFilter
audiopluginexample.LowpassIIRFilter
audiopluginexample.ParametricEqualizerWithUDP
audiopluginexample.ShelvingEqualizer
audiopluginexample.VarSlopeBandpassFilter
visualize
All of these example audio plugins can be used with the visualize
function in order to view the magnitude response of the filters as they are tuned in real time.
audioTestBench
Any audio plugin can be tuned in real time using audioTestBench
. The tool allows you to test an audio plugin with audio signals from a file or device. The tool also enables you to view the power spectrum and the time-domain waveform for the input and output signals.
Update Visualization While Running Plugin
audiopluginexample.BandpassIIRFilter
, audiopluginexample.HighpassIIRFilter
, and audiopluginexample.LowpassIIRFilter
are the simplest of the six examples because the code is written so that the visualization is updated only when data is processed by the filter. Create the audio plugin, then call visualize
and audioTestBench
hpf = audiopluginexample.HighpassIIRFilter; visualize(hpf)
audioTestBench(hpf)
Note that moving the cutoff frequency in audioTestBench
does not update the magnitude response plot. However, once the 'Run' (or play) button is pressed, you can see and hear the changing magnitude response of the filter as the cutoff frequency is tuned in real time.
Update Visualization at Any Time
audiopluginexample.ShelvingEqualizer
and audiopluginexample.VarSlopeBandpassFilter
have visualize
functions which update the magnitude response plot even when not processing data. The visualization is also updated in real time once audio is being processed.
audioTestBench('-close')
varfilter = audiopluginexample.VarSlopeBandpassFilter;
visualize(varfilter)
audioTestBench(varfilter)
Visualize Individual and Combined Magnitude Response
audiopluginexample.ParametricEqualizerWithUDP
illustrates how to visualize individual sections in a 3-section biquad filter along with the overall response of the 3 sections combined.
audioTestBench('-close')
equalizer = audiopluginexample.ParametricEqualizerWithUDP;
visualize(equalizer)
audioTestBench(equalizer)
audioTestBench('-close')