

It's ugly, but here it is: function =makeAweightingFilter(fs) From a now-dead link, I got the transfer function of the form: ka*s^4 I made my own matlab routine a long time ago to give me IIR filter coefficients for A-weighting.
#SCILAB FILTER DESIGN HOW TO#
I have not measured the error curve (dunno how to calculate it against analog model).ĮDIT1: Plot showing HF response for low sample rates (4, 8, 16, 32 kHz): Legend('Analog model', 'Digital (MIM+BLT)', 'location', 'southeast') Lporder = 1 % 1 = 5th order A-Weighting filter, 2= 6th order. NUM = ĭEN = conv(,) ĭEN = conv(conv(DEN,),) % A-weighting filter frequencies according to IEC/CD 1672. % Magnitude Invariance method (MIM) -implementation ( one implementation can be found from )
#SCILAB FILTER DESIGN CODE#
Here's Octave source code for to build the filter: % Octave packages. (green = analog model, red = 5th order filter, black = 6th order filter, small window shows the difference of responses when approaching the Nyqvist frequency) Here are coefficients for 5th and 6th order filters (fs=48kHz) I prepared using separate HPF (c2d)) and LPF (MIM):Ĥth order HPF, 1st order LPF: Ĥth order HPF, 2nd order LPF: Īnd a plot showing comparison against their analog model: The error shows a typical least squares behavior. The right-hand figure shows the approximation error, defined as the absolute value of the difference of the magnitude responses. The left figure shows that one can't see any difference between the logarithmic plots of the analog and the digital frequency responses. Note that both plots go up to Nyquist ($24$ kHz). It's a least squares approximation based on the equation error method, and I might write up all the details some day.īelow is a plot of the design result. The design procedure is a heuristic iterative procedure I came up with some time ago. I chose a sampling frequency of $48$ kHz. However this method suffers from extreme warping near nyquist (even when the analog poles/zeros are pre-warped):įigure 1: A-weighting frequency response comparison where the sample rate is $25600\textrm$$ One method is to use the bilinear transform (BLT) to convert the analog filter to the digital filter (as done here Applying A-weighting).

But there's no definition for a digital filter.
#SCILAB FILTER DESIGN SERIES#
= impz(b2, a2) //impulse response of filter IIRĭisp('Coeficientes do filtro de butterworth') Īctually I'm trying to use the function iir who gives me the error:įilter: Wrong type for input argument #1: Real matrix or polynomial expected.I want to A-weight a time series with arbitrary sample rate.Īn analog A-weighting filter is defined exactly by IEC 61672-1. S = abs(fft(s)) // frequency response of filtered signal S = filter(b2,a2,z) // Filtering the signal = zpbutt(n,wc) // Parâmetros de entrada Title('Resposta em frequência do sinal filtrado') Title('Resposta em frequência do sinal original')

Plot(f(1:round(length(y)/2)),X(1:round(length(y)/2))) ĭisp('Coeficientes do primeiro filtro notch') X=abs(fft(y)) //frequency spectrum of the audio signal T = 0:Ts:1-Ts //Interval of the samplingįa= //fa scroll the signal sampplingį=fa.*fs/(length(y)-1) //Frequency vectors in Hertz Y=loadwave("C:\Users\kaline\Desktop\Disciplinas\2019.1\PDS\2° etapa\Trabalho final\sirene.wav") =wavread("C:\Users\kaline\Desktop\Disciplinas\2019.1\PDS\2° etapa\Trabalho final\sirene.wav") fs,bits Wavread("C:\Users\kaline\Desktop\Disciplinas\2019.1\PDS\2° etapa\Trabalho final\sirene.wav","size")

I tried use the function zpbutt, but I that doesn't worked to me.Also, I tried the function analpf() //Code to filter a audio called sirene.wav I'm trying to filter an audio signal, but I cannot find an IIR filter function in scilab which I can combine with the other function of my code to give an numerator and denominator which I call b2 and a2(2° section).
