Main Content

fdesign.audioweighting

(Removed) Audio weighting filter specification object

Compatibility

Note

The fdesign.audioweighting filter specification object has been removed from DSP System Toolbox™. Use the weightingFilter (Audio Toolbox) System object™ instead. For more information on how to update your existing code, see Version History.

Syntax

HAwf = fdesign.audioweighting
HAwf = fdesign.audioweighting(spec)
HAwf = fdesign.audioweighting(spec,specvalue1,specvalue2)
HAwf = fdesign.audioweighting(specvalue1,specvalue2)
HAwf = fdesign.audioweighting(...,Fs)

Description

Supported audio weighting filter types are: A weighting, C weighting, C-message, ITU-T 0.41, and ITU-R 468–4 weighting.

HAwf = fdesign.audioweighting constructs an audio weighting filter specification object HAwf with a weighting type of A and a filter class of 1. Use the design method and set the 'SystemObject' flag to true, to instantiate a System object based on the specifications in HAwf. Use designmethods to find valid filter design methods. Because the standards for audio weighting filters are in Hz, normalized frequency specifications are not supported for fdesign.audioweighting objects. The default sampling frequency for A weighting, C weighting, C-message, and ITU-T 0.41 filters is 48 kHz. The default sampling frequency for the ITU-R 468–4 filter is 80 kHz. If you invoke the normalizefreq method, a warning is issued when you instantiate the System object and the default sampling frequencies in Hz are used.

HAwf = fdesign.audioweighting(spec) returns an audio weighting filter specification object using default values for the specification in spec. The following are valid entries for spec. The entries are not case sensitive.

  • 'WT,Class' (default spec)

    The 'WT,Class' specification is valid for A weighting and C weighting filters of class 1 or 2.

    The weighting type is specified by the character vector: 'A' or 'C'. The class is the scalar 1 or 2.

    The default values for 'WT,Class' are 'A',1.

  • 'WT'

    The 'WT' specification is valid for C-message (default), ITU-T 0.41, and ITU-R 468–4 weighting filters.

    The weighting type is specified by the character vector: 'Cmessage', 'ITUT041', or 'ITUR4684'.

HAwf = fdesign.audioweighting(spec,specvalue1,specvalue2) constructs an audio weighting filter specification object HAwf and sets its specifications at construction time.

HAwf = fdesign.audioweighting(specvalue1,specvalue2) constructs an audio weighting filter specification object HAwf with the specification 'WT,Class' using the values you provide. The valid weighting types are 'A' or 'C'.

HAwf = fdesign.audioweighting(...,Fs) specifies the sampling frequency in Hz. The sampling frequency is a scalar trailing all other input arguments.

Input Arguments

Name-Value Arguments

WT

Weighting type

The weighting type defines the frequency response of the filter. The valid weighting types are: A weighting, C weighting, C-message, ITU-T 0.41, and ITU-R 468–4 weighting. The weighting types are described in More About.

Class

Filter Class

Filter class is only applicable for A weighting and C weighting filters. The filter class describes the frequency-dependent tolerances specified in the relevant standards [1], [2]. There are two possible class values: 1 and 2. Class 1 weighting filters have stricter tolerances than class 2 filters. The filter class value does not affect the design. The class value is only used to provide a specification mask in FVTool for the analysis of the filter design.

Default: 1

Examples

collapse all

Compare class 1 A weighting and ITU-R 468-4 filters between 0.1 and 12 kHz. Sampling frequency is 44.1 kHz

HawfA = fdesign.audioweighting('WT,Class','A',1,44.1e3);
HawfITUR = fdesign.audioweighting('WT','ITUR4684',44.1e3);

Afilter = design(HawfA,'SystemObject',true);
ITURfilter = design(HawfITUR,'SystemObject',true);

hfvt = fvtool(Afilter,ITURfilter);
axis([0.1 12 -80 20]);
legend(hfvt,'A-weighting','ITU-R 468-4');
hCmessage = fdesign.audioweighting('WT','Cmessage',24e3);
hITUT = fdesign.audioweighting('WT','ITUT041',24e3);
dCmessage = design(hCmessage,'SystemObject',true);
dITUT = design(hITUT,'SystemObject',true);
hfvt = fvtool(dCmessage,dITUT);
legend(hfvt,'C-Message Weighting','ITU-T 0.41 Weighting');
axis([0.1 10 -50 5]);

Construct an ITU-R 468-4 filter using all available design methods.

HAwf = fdesign.audioweighting('WT','ITUR4684');
ValidDesigns = designmethods(HAwf);
% returns iirlpnorm,equiripple,freqsamp in cell array
D = design(HAwf,'all','SystemObject',true); % returns all designs
hfvt = fvtool(D{1},D{2},D{3});
legend(hfvt,'Least P-norm IIR','FIR Equiripple',...,
'FIR Frequency Sampling')

Design a class 2 A-weighted filter.

fs = 48e3;
audioWeightingFilterDesign = fdesign.audioweighting('A',2,fs);

Convert the design to a System object for use.

audioWeightingFilter = design(audioWeightingFilterDesign,...
'SystemObject',true);

Create a spectrumAnalyzer object to visualize original and filtered signals.

windowLength = 2048;
scope = spectrumAnalyzer( ...
    'SampleRate',fs, ...
    'PlotAsTwoSidedSpectrum',false, ...
    'SpectralAverages',50, ...
    'FrequencyScale','Log', ...
    'FrequencyResolutionMethod','WindowLength', ...
    'WindowLength',windowLength, ...
    'Title','A-Weighted Filtering', ...
    'ShowLegend',true, ...
    'ChannelNames',{'Original signal','Filtered signal'});

Apply the A-weighting filter to white noise.

tic
while toc < 10
    x = rand(windowLength,1) - 0.5;
    y = audioWeightingFilter(x);
    scope([x,y])
end

More About

collapse all

A weighting

The specifications for the A weighting filter are found in ANSI standard S1.42-2001. The A weighting filter is based on the 40–phon Fletcher-Munson equal loudness contour [3]. One phon is equal to one dB sound pressure level (SPL) at one kHz. The Fletcher-Munson equal loudness contours are designed to account for frequency and level dependent differences in the perceived loudness of tonal stimuli. The 40–phon contour reflects the fact that the human auditory system is more sensitive to frequencies around 1–2 kHz than lower and higher frequencies. The filter roll off is more pronounced at lower frequencies and more modest at higher frequencies. While A weighting is based on the equal loudness contour for low-level (40–phon) tonal stimuli, it is commonly used in the United States for assessing potential health risks associated with noise exposure to narrowband and broadband stimuli at high levels.

C weighting

The specifications for the C weighting filter are found in ANSI standard S1.42-2001. The C weighting filter approximates the 100–phon Fletcher-Munson equal loudness contour for tonal stimuli. The C weighting magnitude response is essentially flat with 3–dB frequencies at 31.5 Hz and 8000 Hz. While C weighting is not as common as A weighting, sound level meters frequently have a C weighting filter option.

C-message

The specifications for the C–message weighting filter are found in Bell System Technical Reference, PUB 41009. C-message weighting filters are designed for measuring the impact of noise on telecommunications circuits used in speech transmission [6]. C-message weighting filters are commonly used in North America, while the ITU-T 0.41 filter is more commonly used outside of North America.

ITU-R 468–4

The specifications for the ITU-R 486–4 weighting filter are found in the International Telecommunication Union Recommendation ITU-R BS.468-4. ITU-R 486–4 is an equal loudness contour weighting filter. Unlike the A weighting filter, the ITU-R 468–4 filter describes subjective loudness judgements for broadband stimuli [4]. A common criticism of the A weighting filter is that it underestimates the loudness judgement of real-world stimuli particularly in the frequency band from about 1–9 kHz. A comparison of A weighting and ITU-R 468–4 weighting curves shows that the ITU-R 468–4 curve applies more gain between 1 and 10 kHz with a peak difference of approximately 12 dB around 6–7 kHz.

ITU-T 0.41

The specifications for the ITU-T 0.41 filter are found in the ITU-T Recommendation 0.41. ITU-T 0.41 weighting filters are designed for measuring the impact of noise on telecommunications circuits used in speech transmission [5]. ITU-T 0.41 weighting filters are commonly used outside of North America, while the C-message weighting filter is more common in North America.

References

[1] American National Standard Design Response of Weighting Networks for Acoustical Measurements, ANSI S1.42-2001, Acoustical Society of America, New York, NY, 2001.

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

[3] Fletcher, H. and W.A. Munson. “Loudness, its definition, measurement and calculation.” Journal of the Acoustical Society of America, Vol. 5, 1933, pp. 82–108.

[4] Measurement of Audio-Frequency Noise Voltage Level in Sound Broadcasting, International Telecommunication Union Recommendation ITU-R BS.468-4, 1986.

[5] Psophometer for Use on Telephone-Type Circuits, ITU-T Recommendation 0.41.

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

Version History

Introduced in R2011a

expand all

R2023b: fdesign.audioweighting has been removed

The fdesign.audioweighting filter specification object has been removed. Use the weightingFilter (Audio Toolbox) System object instead.

Update Code

This table shows how the object is typically used and explains how to update the existing code to use the weightingFilter object. The weightingFilter object requires Audio Toolbox™.

Discouraged UsageRecommended Replacement

A-weighting filter

Design a class 2, A-weighting filter for a sample rate of 44.1 kHz.

 Fs = 44100;
 d  = fdesign.audioweighting('WT,Class','A',2,Fs)
 wf = design(d,'Systemobject',true);
 

Visualize the filter response and make sure it fits within the Class 2 mask.

fvtool(wf)

A-weighting filter

Design a class 2, A-weighting filter for a sample rate of 44.1 kHz.

    Fs = 44100;
    wf = weightingFilter('A-weighting',Fs);
 

Visualize the filter response and make sure it fits within the Class 2 mask.

visualize(wf,'class 2');

C-weighting filter

Design a class 2, C-weighting filter for a sample rate of 44.1 kHz.

 Fs = 44100;
 d  = fdesign.audioweighting('WT,Class','C',2,Fs)
 wf = design(d,'Systemobject',true);
 

Visualize the filter response and make sure it fits within the Class 2 mask.

fvtool(wf)

C-weighting filter

Design a class 2, C-weighting filter for a sample rate of 44.1 kHz.

    Fs = 44100;
    wf = weightingFilter('C-weighting',Fs);
 

Visualize the filter response and make sure it fits within the Class 2 mask.

visualize(wf,'class 2');