Main Content

This example shows how to obtain designs for the most common weighting filters - A-weighting, C-weighting, C-message, ITU-T 0.41, and ITU-R 468-4 - using the `weightingFilter`

System object and audio weighting filter designer, `fdesign.audioweighting`

, in the Audio Toolbox™.

In many applications involving acoustic measurements, the final sensor is the human ear. For this reason, acoustic measurements usually attempt to describe the subjective perception of a sound by this organ. Instrumentation devices are built to provide a linear response, but the ear is a nonlinear sensor. Special filters, known as weighting filters, are used to account for the nonlinearities.

You can design A and C weighting filters that follow the ANSI S1.42 [1] and IEC 61672-1 [2] standards using `weightingFilter`

System object. An A-weighting filter is a bandpass filter designed to simulate the perceived loudness of low-level tones. An A-weighting filter progressively de-emphasizes frequencies below 500 Hz. A C-weighting filter removes sounds outside the audio range of 20 Hz to 20 kHz and simulates the loudness perception of high-level tones. The following code designs an IIR filter for A-weighting with a sampling rate of 48 kHz.

`AWeighting = weightingFilter('A-weighting',48000)`

AWeighting = weightingFilter with properties: Method: 'A-weighting' SampleRate: 48000

A and C-weighting filter designs are based on direct implementation of the filter's transfer function based on poles and zeros specified in the ANSI S1.42 standard.

The IEC 61672-1 standard requires that the filter magnitudes fall within a specified tolerance mask. The standard defines two masks, one with stricter tolerance values than the other. A filter that meets the tolerance specifications of the stricter mask is referred to as a Class 1 filter. A filter that meets the specifications of the less strict mask is referred to as a Class 2 filter. You can view the magnitude response of the filter along with a mask corresponding to Class 1 or Class 2 specifications by calling the `visualize`

method on the object. Note that the choice of the Class value will not affect the filter design itself but it will be used to render the correct tolerance mask in the visualization plot.

`visualize(AWeighting,'class 1')`

The A- and C-weighting standards specify tolerance magnitude values for up to 20 kHz. In the following example we use a sample rate of 28 kHz and design a C-weighting filter. Even though the Nyquist interval for this sample rate is below the maximum specified 20 kHz frequency, the design still meets the Class 2 tolerances as shown by the green mask around the magnitude response plot. The design, however, does not meet Class 1 tolerances due to the small sample rate value and you will see the mask around the magnitude response plot turn red.

`CWeighting = weightingFilter('C-weighting',28000)`

CWeighting = weightingFilter with properties: Method: 'C-weighting' SampleRate: 28000

visualize(CWeighting,'class 2') visualize(CWeighting,'class 1')

ITU-R 468-4 recommendation [3] was developed to better reflect the subjective loudness of all types of noise, as opposed to tones. ITU-R 468-4 weighting was designed to maximize its response to the types of impulsive noise often coupled into audio cables as they pass through telephone switching facilities. ITU-R 468-4 weighting correlates well with noise perception, since perception studies have shown that frequencies between 1 kHz and 9 kHz are more "annoying" than indicated by A-weighting.

You design a weighting filter based on the ITU-R 468-4 standard using `fdesign.audioweighting`

specification object. You can choose between frequency sampling or equiripple approximations for an FIR filter design, or use a least P-norm approximation for an IIR filter design. In all cases, the filters are designed with the minimum order that meets the standard specifications (mask) for the sample rate at hand.

ITUR4684Designer = fdesign.audioweighting('WT','ITUR4684',80e3)

ITUR4684Designer = audioweighting with properties: Response: 'Audio Weighting' Specification: 'WT' Description: {'Weighting type'} NormalizedFrequency: 0 Fs: 80000 WeightingType: 'ITUR4684'

ITUR4684FIR = design(ITUR4684Designer,'allfir','SystemObject',true); visualizer = fvtool(ITUR4684FIR{1}); addfilter(visualizer,ITUR4684FIR{2}); legend(visualizer,'ITU-R 468-4 FIR equiripple approximation', ... 'ITU-R 468-4 FIR frequency sampling approximation')

ITUR4684IIR = design(ITUR4684Designer,'iirlpnorm','SystemObject',true); setfilter(visualizer,ITUR4684IIR); legend(visualizer,'ITU-R 468-4 IIR least P-norm approximation')

While IIR designs yield smaller filter orders, FIR designs have the advantage of a linear phase response. In the FIR designs, the equiripple design method will usually yield lower filter orders when compared to the frequency sampling method but might have some design-time convergence issues at large sample rates.

ITU-T 0.41 and C-message weighting filters are bandpass filters used to measure audio-frequency noise on telephone circuits. The ITU-T 0.41 filter is used for international telephone circuits. The C-message filter is typically used for North American telephone circuits. The frequency response of the ITU-T 0.41 and C-message weighting filters is specified in the ITU-T O.41 standard [4] and Bell System Technical Reference 41009 [5], respectively.

You design an ITU-T 0.41 weighting filter for a sample rate of 24 kHz using the following code. You can choose from FIR frequency sampling or equiripple approximations. The filters are designed with the minimum order that meets the standard specifications (mask) for the sampling frequency at hand.

ITUTDesigner = fdesign.audioweighting('WT','ITUT041',24e3); ITUT = design(ITUTDesigner,'allfir','SystemObject',true); setfilter(visualizer,ITUT{1}); addfilter(visualizer,ITUT{2}); legend(visualizer,'ITU-T 0.41 FIR equiripple approximation', ... 'ITU-T 0.41 FIR frequency sampling approximation')

You design a C-message weighting filter for a sample rate of 51.2 kHz using the following code. You can choose from FIR frequency sampling or equiripple approximations or from an exact IIR implementation of poles and zeros based on the poles and zeros specified in [6]. You obtain the IIR design by selecting the 'bell41009' design method. The FIR filter approximations are designed with the minimum order that meets the standard specifications (mask) for the sample rate at hand.

CMessageDesigner = fdesign.audioweighting('WT','Cmessage',51.2e3); CMessageFIR = design(CMessageDesigner,'allfir','SystemObject',true); setfilter(visualizer,CMessageFIR{1}); addfilter(visualizer,CMessageFIR{2}); legend(visualizer,'C-message FIR equiripple approximation', ... 'C-message FIR frequency sampling approximation')

CMessageIIR = design(CMessageDesigner,'bell41009','SystemObject',true); setfilter(visualizer,CMessageIIR); legend(visualizer,'C-message weighting (IIR)')

Some audio weighting standards do not specify exact pole/zero values, instead, they specify a list of frequency values, magnitudes and tolerances. If the exact poles and zeros are not specified in the standard, filters are designed using frequency sampling, equiripple, or IIR least P-norm arbitrary magnitude approximations based on the aforementioned list of frequency values, attenuations, and tolerances. The filter order of the arbitrary magnitude designs is chosen as the minimum order for which the resulting filter response is within the tolerance mask limits. Designs target the specification mask tolerances only within the Nyquist interval. If Fs/2 is smaller than the largest mask frequency value specified by the standard, the design algorithm will try to meet the specifications up to Fs/2.

In the FIR designs, the equiripple design method usually yields lower filter orders when compared to the frequency sampling method but might have some convergence issues at large sample rates.

[1] 'Design Response of Weighting Networks for Acoustical Measurements', American National Standard, ANSI S1.42-2001.

[2] 'Electroacoustics Sound Level Meters Part 1: Specifications', IEC 61672-1, First Edition 2002-05.

[3] 'Measurement of Audio-Frequency Noise Voltage Level in Sound Broadcasting', Recommendation ITU-R BS.468-4 (1970-1974-1978-1982-1986).

[4] 'Specifications for Measuring Equipment for the Measurement of Analogue Parameters, Psophometer for Use on Telephone-Type Circuits', ITU-T Recommendation 0.41.

[5] 'Transmission Parameters Affecting Voiceband Data Transmission-Measuring Techniques', Bell System Technical Reference, PUB 41009, 1972.

[6] 'IEEE® Standard Equipment Requirements and Measurement Techniques for Analog Transmission Parameters for Telecommunications', IEEE Std 743-1995 Volume , Issue , 25, September 1996.