converting a filter to a logarithmic equation

48 Views Asked by At

I'm implementing a filter

The formula for the filter is shown below with y(n) as the output, x(n) as the new input, c is the filter coefficient.

y(n) = c⋅[x(n)–y(n–1)]+y(n–1)

c is calculated as c = 1-exp(-R/(T*F));

I wrote a program to calculate y(n) using the above calculations. But now I want to convert x(n) from its linear form to its logarithmic form.

so if x(n) is converted to log2(x(n)). Which is now the input is logarithmic and Not linear. Im certain either the filter equation or the coefficient equation should be modified . But I'm not sure how. Could someone give me some ideas on how I would go about implementing this? Thank you.

edited for more clarity:

I'm implementing an Attack & Release filter to control peak and troughs in a speech signal. The formula for an A&R filter is above. Im implementing this in a 16 bit DSP processor. I know x(n).

x(n) is the energy of an input signal. for a given speech signal, I'll do the FFT. Get the real and imaginary parts. Then x(n) = r^2+i^2. Now x(n) is usually less than what a 16 bit data can accommodate. Therefore it is better to calculate log2(x(n)). Then apply the above filter to the logarithmic value. This filter is applied to each block of data. Im using a 32 point FFT. The filter will be applied to 16 samples of energy data. x(n) will be logarithmic input energy data. y(n-1) will be the previous logarithmic sample of data