Standards-based graphic equalizer
System object™ implements a graphic equalizer that can tune the gain on individual octave or
fractional octave bands. The object filters the data independently across each input channel
over time using the filter specifications. Center and edge frequencies of the bands are based
on the ANSI S1.11-2004 standard.
To equalize an audio signal:
graphicEQobject and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
creates a graphic
equalizer with default values.
equalizer = graphicEQ
sets each property
equalizer = graphicEQ(
Name to the specified
Unspecified properties have default values.
equalizer = graphicEQ('Structure','Parallel','EQOrder','1/3
octave') creates a System object,
equalizer, which implements filtering using a parallel
structure and one-third octave filter bandwidth.
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
Gains — Gain of each octave or fractional octave band (dB)
[0 0 0 0 0 0 0 0 0 0] (default) | 10-, 15-, or 30-element row vector
Gain of each octave of fractional octave band in dB, specified as a row vector with a length determined by the Bandwidth property:
'1 octave'–– Specify gains as a 10-element row vector.
'2/3 octave'–– Specify gains as a 15-element row vector.
'1/3 octave'–– Specify gains as a 30-element row vector.
equalizer = graphicEQ('Bandwidth','2/3
octave','Gains',[5,5,5,5,5,0,0,0,0,0,-5,-5,-5,-5,-5]) creates a two-third
octave graphic equalizer with specified gains.
You can tune the gains of your graphic equalizer when the object is locked. However, you cannot tune the length of the gains when the object is locked.
EQOrder — Order of individual equalizer bands
2 (default) | positive even integer
Order of individual equalizer bands, specified as a positive even integer. All equalizer bands have the same order.
Bandwidth — Filter bandwidth (octaves)
'1 octave' (default) |
'2/3 octave' |
Filter bandwidth in octaves, specified as
'2/3 octave', or
The ANSI S1.11-2004 standard defines the center and edge frequencies of your equalizer. The ISO 266:1997(E) standard specifies corresponding preferred frequencies for labeling purposes.
SampleRate — Input sample rate (Hz)
44100 (default) | positive scalar
Input sample rate in Hz, specified as a positive scalar.
audioIn — Audio input to graphic equalizer
Audio input to the graphic equalizer, specified as a matrix. The columns of the matrix are treated as independent audio channels.
audioOut — Audio output from graphic equalizer
Audio output from the graphic equalizer, returned as a matrix the same size as
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named
Specific to graphicEQ
functions map tunable properties of the
System object to user-facing parameters:
Perform Graphic Equalization
Create objects to read from an audio file and write to your audio device. Use the sample rate of the reader as the sample rate of the writer.
frameLength = 512; reader = dsp.AudioFileReader('RockDrums-48-stereo-11secs.mp3','SamplesPerFrame',frameLength); player = audioDeviceWriter('SampleRate',reader.SampleRate);
In an audio stream loop, read audio from a file and play the audio through your audio device.
while ~isDone(reader) x = reader(); player(x); end release(reader) release(player)
Create a one-octave graphic equalizer implemented with a cascade structure. Use the sample rate of the reader as the sample rate of the equalizer.
equalizer = graphicEQ( ... 'Bandwidth','1 octave', ... 'Structure','Cascade', ... 'SampleRate',reader.SampleRate);
Specify to increase the gain on low frequencies and then visualize the equalizer.
equalizer.Gains = [5,5,5,5,0,0,0,0,0,0]; visualize(equalizer)
In an audio stream loop, read audio from a file, apply equalization, and then play the equalized audio through your audio device.
while ~isDone(reader) x = reader(); y = equalizer(x); player(y); end release(reader) release(player)
Tune Graphic EQ Parameters
dsp.AudioFileReader to read in audio frame-by-frame. Create an
audioDeviceWriter to write audio to your sound card. Create a
graphicEQ to process the audio data. Call
visualize to plot the frequency response of the graphic equalizer.
frameLength = 1024; fileReader = dsp.AudioFileReader('RockDrums-44p1-stereo-11secs.mp3','SamplesPerFrame',frameLength); deviceWriter = audioDeviceWriter('SampleRate',fileReader.SampleRate); equalizer = graphicEQ('SampleRate',fileReader.SampleRate,'Gains',[0,10,-10,5,-5,2,-2,1,-1,0]); visualize(equalizer)
parameterTuner to open a UI to tune parameters of the equalizer while streaming.
In an audio stream loop:
Read in a frame of audio from the file.
Write the frame of audio to your audio device for listening.
While streaming, tune parameters of the equalizer and listen to the effect.
while ~isDone(fileReader) audioIn = fileReader(); audioOut = equalizer(audioIn); deviceWriter(audioOut); drawnow limitrate % required to update parameter end
As a best practice, release your objects once done.
release(deviceWriter) release(fileReader) release(equalizer)
The implementation of your graphic equalizer depends on the
property. See Graphic Equalization for a discussion of the pros and cons of the parallel
and cascade implementations. Refer to the following sections to understand how these
algorithms are implemented in Audio Toolbox™.
The parallel implementation designs the individual equalizers using the
method and spaces them on the spectrum according to the ANSI S1.11-2004
If you set the SampleRate
property so that the Nyquist frequency
) is less than the final bandpass
edge defined by the ANSI S1.11-2004 standard, then:
The final bandpass filter is the one whose upper bandpass edge is less than the Nyquist frequency.
The final filter is implemented as a highpass filter designed by the
The input signal is fed into a filterbank of M filters, where M depends on the specified
Each branch of the filterbank is multiplied by the linear form of the corresponding element of the
The branches are summed and the output signal is returned.
The cascade implementation designs the graphic equalizer filter bank using the
If the EQOrder
property is set to 2, then a gain correction is calculated according to . The gain correction is
independent of the requested gains. The gain correction is recomputed during the real-time
processing only if the
SampleRate property is modified.
EQOrder property is not set to 2, no gain correction is
applied, and the requested gains are passed on to the
The input signal is fed into a cascade of M biquad filters, where
M depends on the specified
 Oliver, Richard J., and Jean-Marc Jot. "Efficient Multi-Band Digital Audio Graphic Equalizer with Accurate Frequency Response Control." Presented at the 139th Convention of the AES, New York, October 2015.
 Acoustical Society of America. American National Standard Specification for Octave-Band and Fractional-Octave-Band Analog and Digital Filters. ANSI S1.11-2004. Melville, NY: Acoustical Society of America, 2009.
 International Organization for Standardization. Acoustics –– Preferred frequencies. ISO 266:1997(E). Second Edition. 1997.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
System Objects in MATLAB Code Generation (MATLAB Coder)