Shelving Equalizer Design
Libraries:
Audio Toolbox /
Filters
Description
The Shelving Equalizer Design block designs a shelving equalizer with the specified gain, slope, and cutoff frequency. You can choose to design a low-shelf or a high-shelf equalizer. The block outputs the coefficients of a second-order section (SOS) filter, which you can use with the Second-Order Section Filter block to filter audio signals. You can tune the filter parameters during simulation.
Examples
Design Shelving Equalizer in Simulink
Use the Shelving Equalizer Design block to design a shelving equalizer and pass the coefficients to a Second-Order Section Filter block to filter a signal of random noise. Tune the filter parameters using the dashboard controls and see how the spectrum of the filtered signal changes.
Ports
Input
G — Peak gain (dB)
real scalar
Use this port to specify the value of the Peak gain (dB) parameter.
Dependencies
To enable this port, select the Specify peak gain from input port parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
S — Slope coefficient
positive scalar
Use this port to specify the value of the Slope coefficient parameter.
Dependencies
To enable this port, select the Specify slope coefficient from input port parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Fc — Normalized cutoff frequency
scalar in range [0,1]
Use this port to specify the value of the Normalized cutoff frequency parameter.
Dependencies
To enable this port, select the Specify normalized cutoff frequency from input port parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
T — Filter type
0
(low-shelf) | 1
(high-shelf)
Use this port to specify the value of the Filter
type parameter; 0
corresponds to a low-shelf
equalizer and 1
corresponds to a high-shelf equalizer.
Dependencies
To enable this port, select the Specify filter type from input port parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| enumerated
Output
Num — Numerator filter coefficients
three-element row vector
Numerator filter coefficients of the designed SOS filter, returned as a three-element row vector.
Dependencies
The data type of the output depends on the Output data type parameter.
Data Types: single
| double
Den — Denominator filter coefficients
three-element row vector
Denominator filter coefficients of the designed SOS filter, returned as a three-element row vector.
Dependencies
The data type of the output depends on the Output data type parameter.
Data Types: single
| double
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Smooth tuned filter parameters — Smooth filter parameters when tuning
off
(default) | on
Select this parameter to gradually change a filter parameter to the new value when tuning it. If you clear this parameter, the tuned parameter immediately switches to the new value. Specify the level of smoothing with the Smoothing factor parameter.
Smoothing factor — Smoothing factor for tuned parameters
0.6
(default) | scalar in range [0,1)
Smoothing factor for tuned parameters, specified as a scalar in the range [0,1). As the smoothing factor approaches 1, a tuned parameter changes more gradually to the new value. A smoothing factor of 0 is equivalent to no smoothing.
For more information about smoothing, see Smoothing.
Tunable: Yes
Dependencies
To enable this parameter, select the Smooth tuned filter parameters parameter.
Specify peak gain from input port — Use additional input port to specify gain
off
(default) | on
When you select this parameter, an additional input port, G, is added to the block. Use this port to specify the gain of the filter.
Peak gain (dB) — Peak gain (dB)
0
(default) | real scalar
Peak gain of the filter in dB, specified as a real scalar. The gain specifies how much the filter boosts (if the gain is positive) or cuts (if the gain is negative) the frequency spectrum of the input signal.
Tunable: Yes
Dependencies
To enable this parameter, clear the Specify peak gain from input port parameter.
Specify slope coefficient from input port — Use additional input port to specify slope coefficient
off
(default) | on
When you select this parameter, an additional input port, S, is added to the block. Use this port to specify the slope of the filter.
Slope coefficient — Slope coefficient
1.5
(default) | positive scalar
Slope coefficient of the filter, specified as a positive scalar. The slope controls the width of the transition band in the filter response.
Tunable: Yes
Dependencies
To enable this parameter, clear the Specify slope coefficient from input port parameter.
Specify normalized cutoff frequency from input port — Use additional input port to specify normalized cutoff frequency
off
(default) | on
When you select this parameter, an additional input port, Fc, is added to the block.
Normalized cutoff frequency — Normalized cutoff frequency
0.1
(default) | scalar in range [0,1]
Normalized cutoff frequency of the filter, specified as a scalar in the range [0,1] where 1 corresponds to the Nyquist frequency. The cutoff frequency specifies the frequency at half of the peak gain of the filter, G/2 dB, where G is the peak gain.
Tunable: Yes
Dependencies
To enable this parameter, clear the Specify normalized cutoff frequency from input port parameter.
Specify filter type from input port — Use additional input port to specify filter type
off
(default) | on
When you select this parameter, an additional input port, T, is added to the block.
Filter type — Type of shelving equalizer
low
(default) | high
Type of shelving equalizer, specified as low
for a
low-shelf equalizer or high
for a high-shelf
equalizer.
A low-shelf equalizer boosts or cuts the frequency spectrum below the cutoff frequency.
A high-shelf equalizer boosts or cuts the frequency spectrum above the cutoff frequency.
Output data type — Data type of output coefficients
double
(default) | single
Data type of output coefficients, specified as double
or
single
.
Sample time — Sample time of block
-1
(default) | positive scalar
Sample time of the block, in seconds, specified as -1
or a
positive scalar. Setting this parameter to -1
means Simulink determines the sample time automatically for you. You can set this
parameter to enable the design block to run at a slower rate than the filtering
block.
Simulate using — Specify type of simulation to run
Interpreted execution
(default) | Code generation
Interpreted execution
–– Simulate model using the MATLAB® interpreter. This option shortens startup time but has a slower simulation speed thanCode generation
. In this mode, you can debug the source code of the block.Code generation
–– Simulate model using generated C code. The first time you run a simulation, Simulink generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time, but the speed of the subsequent simulations is comparable toInterpreted execution
.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Algorithms
Smoothing
When you select Smooth tuned filter parameters, the Shelving Equalizer Design block uses the following formula to gradually adjust the parameter to the target value when tuning. The block redesigns the filter at each time step with the intermediate parameter values, until the target value is reached.
where:
n is the time step in the simulation.
g is the instantaneous smoothed parameter.
t is the target value for the tuned parameter.
α is the smoothing factor, specified by the Smoothing factor parameter.
References
[1] Bristow-Johnson, Robert. "Cookbook Formulae for Audio EQ Biquad Filter Coefficients." Accessed September 13, 2021. https://webaudio.github.io/Audio-EQ-Cookbook/Audio-EQ-Cookbook.txt.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2024a
See Also
Blocks
Functions
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)