## C-weighting filter

September 25, 2011 Coded in Matlab

The code below will generate coefficients for a digital C-weighting filter.  What is a C-weighting filter you say?  Perhaps this wikipedia article can help? http://en.wikipedia.org/wiki/A-weighting

Basically, this filter is used to approximate how humans perceive the loudness of a signal by emphasizing/deemphasizing key frequencies on the auditory system.  Generate the coefficients base on your sampling rate and then filter you audio signal to see how the ear percieves the signal.  Something you might think would be lud turn out to be very tiny and other signals may grow in intensity.

This is very similar to my A-weighting post, but has a different looking contour.  I don't have a source for this, but I have heard from colleagues that C-weighting should be used when the listening level is 90dB SPL and higher.  For lower listening levels you should use the A-weight.

``````%Sampling Rate
Fs = 48000;

%Analog C-weighting filter according to IEC/CD 1672.
1672.
f1 = 20.598997;
f4 = 12194.217;
C1000 = 0.0619;
pi  = 3.14159265358979;
NUM = [ (2*pi*f4)^2*(10^(C1000/20)) 0 0 ];
DEN = conv([1 +4*pi*f4 (2*pi*f4)^2],[1 +4*pi*f1 (2*pi*f1)^2]);

%Bilinear transformation of analog design to get the digital [b,a] = bilinear(NUM,DEN,Fs);``````