Electronics > Projects, Designs, and Technical Stuff
Calculating filter coefficient from a transfer function - literature not clear
(1/4) > >>
Yansi:
Hello,

just got into reading a book from Udo Zölzer, DAFX Digital audio effects (link). I've been researching about programming a signal limiter/compressor and found this awesome book.

So straight into the Chapter 5, on page 98, in Figure 5.6 there are peak and RMS detector systems:



 On the bottom of that page is an equation, stating all coefficient there (AT, RT and TAV) can be calculated using this very same formula:



Details (but not enough) about that formula are provided on the next page, 99.  I got quite curious about the constant "2.2" in the exponent.  There is a reference to a [McN84] (jeez I hate this style of references!) literature, this one: BBC Digital Audio Dynamic Range Control report (link).

Relevant stuff starts at page 10, derivation of the equation is presumably on the page 11:



However, I do not see any formula with either Log or Exp within, only this one seem to be related:



It calculates the time constant of the filter: tau = 1 / 2*Pi*fc (presumably??)
If I plug in some numbers in the equation from Zölzer,  for example 10ms @48kHz fs, I get the coefficient to be A = 0.004572845.

Now if I plug this A constant into the equation from the BBC paper, I get a completely different time constant back, something like 4.55ms.

Yes, the two equations does not seem to be related at all, I was only silly trying that. But how the hell did Zölzer come up with his exponential equation, based on the reference paper?


//Edit!:   Supposed the low pass configuration in the system above is indeed equivalent to the classic single-pole filter, then the coefficient shall be
A = 1 - Exp(-2Pi*fc/fs) = 1 - Exp(-2Pi*Ts/t), shouldn't it?

The PDF seems to have gone through OCR, isn't this just a misprint, or misOCRed respectively?  :o
bson:
What is tau?  In many filters it's a parameter that controls decay, spread, number of lobes etc, which is the number of samples, the time delay, or some other aspect (e.g. # of lobes in a sinc filter), before the output is 0. If so, 2.2 might be a constant that is "a little more than nyquist".
Wimberleytech:
I am not certain I can follow what your question is.  However, I did duplicate the analysis from the paper and discovered there is an error in one of their steps.  The final result for omega (-3dB) is correct, however.
Yansi:
Sorry if my question was not clear enough.

I think, that the equation for calculating the AT, TAV and RT coefficients is wrong. And after bit of fiddling in Octave, I can prove it is indeed wrong.

We are talking about this eqn from the Zölzer, page 98:



this eqn should give us the constant to this kind of one-pole low pass filter structure, as seen from the figures 5.6, 5.7 and others (a section of Fig 5.7):



The time constant, is the time constant of the filter, i.e as in the BBC paper:  omega = 1/tau.   Tau is either the AT or RT  time constant (attack/release time constant) of the filter element.

By plugging some numbers in Octave, I have concluded, that the equation K = 1 - Exp(-2.2 * T/t) is flawed. The measured time for the exponential to reach 63% was very incorrect.

I am certain, that this equation for a one-pole filter is correct:  K = 1 -  Exp(-2*Pi * fc/fs)
By substituing both fs (sampling frequency) with Ts (sampling period) and fc (cutoff frequency) with the time constant (which relates to fc = 1/(2*Pi*tau), we then get:

K = 1 -  Exp(-T/t)

Verifying in Octave shows a correct result.  I have put into Octave the whole structure from Fig 5.7 (Zölzer pg 98). The Octave .m file is attached, if you want to look.

I have absolutely no idea, where or how the 2.2 constant got there. It ain't right. Plot below with the corrected formula above, yields correct time constants for the filters. Plotted for  4ms attack and 50ms decay.



Also, I noted that the RMS detector in Fig 5.6 has an error in it, apart from the missing square root on the output: There should very likely be a minus sign at that summing node.




.m file in zip archive:
 AT_RT_filter.zip (0.75 kB - downloaded 43 times.)

//EDIT: FUCKING HELL, the forum randomly swaps the attachments. SHIT!!!
//EDIT2: COrrected.
//EDIT3: Added time constant description for the plot.
Wimberleytech:

--- Quote from: Yansi on November 30, 2019, 10:23:17 pm ---
By plugging some numbers in Octave, I have concluded, that the equation K = 1 - Exp(-2.2 * T/t) is flawed. The measured time for the exponential to reach 63% was very incorrect.


--- End quote ---

I wonder if the time constant is based on something other than 63% ?  Perhaps 90% or so???
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod