Weighting Filter
Weighted frequency response filter
Libraries:
Audio Toolbox /
Filters
Description
The Weighting Filter block performs frequency-weighted filtering independently across each input channel.
Examples
Apply Frequency Weighting
Examine the Weighting Filter block in a Simulink® model and tune parameters.
Ports
Input
Port_1 — Input signal
matrix | 1-D vector
Matrix input –– Each column of the input is treated as an independent channel.
1-D vector input –– The input is treated as a single channel.
Data Types: single
| double
Output
Port_1 — Output signal
matrix
The Weighting Filter block outputs a signal with the same data type as the input signal. The size of the output depends on the size of the input:
Matrix input –– The block outputs a matrix the same size and data type as the input signal.
1-D vector input –– The block outputs an N-by-1 matrix (column vector), where N is the number of elements in the 1-D vector.
Data Types: single
| double
Parameters
If a parameter is listed as tunable, then you can change its value during simulation.
Weighting method — Type of frequency weighting
A-weighting
(default) | C-weighting
| K-weighting
See A-Weighting, C-Weighting, and K-Weighting for the definition of the weighting curves.
Tunable: No
Inherit sample rate from input — Specify source of input sample rate
off
(default) | on
When you select this parameter, the block inherits its sample rate from the input signal. When you clear this parameter, you specify the sample rate in Input sample rate (Hz).
Tunable: No
Input sample rate (Hz) — Sample rate of input
44100
(default) | positive scalar
Tunable: Yes
Dependencies
To enable this parameter, clear the Inherit sample rate from input parameter.
Simulate using — Specify type of simulation to run
Code generation
(default) | Interpreted execution
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 faster thanInterpreted execution
.Interpreted execution
–– Simulate model using the MATLAB® interpreter. This option shortens startup time but has a slower simulation speed compared toCode generation
. In this mode, you can debug the source code of the block.
Tunable: No
Mask for attenuation limits — Creates a mask for filter response visualization
No mask
(default) | Class 1
| Class 2
The mask attenuation limits are defined in the IEC 61672-1:2002 standard.
If the mask is green, the design is compliant.
If the mask is red, the design breaks compliance.
Tunable: Yes
Dependencies
To enable this parameter, set Weighting method to
A-weighting
or
C-weighting
.
Visualize filter response — Open plot to visualize magnitude response and compliance mask
button
A 2048-point FFT is used to calculate the magnitude response.
Tunable: Yes
Variable name — Variable name of exported filter
myFilt
(default) | valid variable name
Name of the variable in the base workspace to contain the filter when it is exported. The name must be a valid MATLAB variable name.
Overwrite variable if it already exists — Overwrite variable if it already exists
on
(default) | off
When you select this parameter, exporting the filter overwrites the
variable specified by the Variable name parameter if it
already exists in the base workspace. If you do not select this parameter
and the specified variable already exists in the workspace, exporting the
filter creates a new variable with an underscore and a number appended to
the variable name. For example, if the variable name is
var
and it already exists, the exported variable will
be named var_1
.
Export filter to workspace — Export filter to workspace
button
Export the filter to the base workspace in the variable specified by the Variable name parameter.
Tips
You cannot export the filter if you have enabled the Inherit sample rate from input parameter and the model is not running.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
More About
A-Weighting
The A-curve is a wide bandpass filter centered at 2.5 kHz, with approximately 20 dB attenuation at 100 Hz and 10 dB attenuation at 20 kHz. A-weighted SPL measurements of noise level are increasingly found in sales literature for domestic appliances. In most countries, the use of A-weighting is mandated for the protection of workers against noise-induced deafness. The ISO and ICOA standards mandate A-weighting for all civil aircraft noise measurements.
The ANSI S1.42.2001 [1] defines this weighting curve. The IEC 61672-1:2002 [2] standard defines the minimum and maximum attenuation limits for an A-weighting filter.
ANSI S1.42.2001 defines the weighting curve by specifying analog poles and zeros. Audio Toolbox™ converts the specified poles and zeros to the digital domain using a bilinear transform:
C-Weighting
The C-curve is "flat," but with limited bandwidth: It has –3 dB corners at 31.5 Hz and 8 kHz. C-curves are used in sound level meters for sounds that are louder than sounds intended for A-weighting filters.
The ANSI S1.42-2001 [1] defines the C-weighting curve. The IEC 61672-1:2002 [2] standard defines the minimum and maximum attenuation limits for C-weighting filters.
ANSI S1.42.2001 defines the weighting curve by specifying analog poles and zeros. Audio Toolbox converts the specified poles and zeros to the digital domain using a bilinear transform:
K-Weighting
The K-weighting filter is used for loudness normalization in broadcast. It is composed of two stages of filtering: a first stage shelving filter and a second stage highpass filter.
The ITU-R BS.1770-4 [3] standard defines this curve.
Assume a second-order filter.
|
The table shows the coefficients for the filters.
First Stage Shelving Coefficients | Second Stage Highpass Coefficients |
---|---|
The coefficients presented by ITU-R BS.1770-4 are defined for 48 kHz. These coefficients are recomputed for nonstandard sample rates using the algorithm described in [4].
References
[1] Acoustical Society of America. Design Response of Weighting Networks for Acoustical Measurements. ANSI S1.42-2001. New York, NY: American National Standards Institute, 2001.
[2] International Electrotechnical Commission. Electroacoustics Sound Level Meters Part 1: Specifications. First Edition. IEC 61672-1. 2002-2005.
[3] International Telecommunication Union. Algorithms to measure audio programme loudness and true-peak audio level. ITU-R BS.1770-4. 2015.
[4] Mansbridge, Stuart, Saoirse Finn, and Joshua D. Reiss. "Implementation and Evaluation of Autonomous Multi-track Fader Control." Paper presented at the 132nd Audio Engineering Society Convention, Budapest, Hungary, 2012.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2016b
See Also
weightingFilter
| octaveFilter
| loudnessMeter
| Octave Filter | Loudness Meter
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)