Page 1 of 1

Weighted Sound and LEQ

Posted: Fri Oct 06, 2017 10:14 pm
by waverlye
In the Nyquist plugins to perform A-Weighted measurements I've seen this code.

; A-weighted version of sound - by Edgar (thanks!)
(setq sa (lp (lp (hp (hp (hp (hp s-in 20.6) 20.6) 107.7) 737.9) 12200) 12200))

1) Is this the order in which the data will pass, which makes sense but I just want to be sure.
2) 20.6 and 1200 are used twice in a row. Should I take this to mean this is the equivalent of a 2nd order filter and all other reference are 1st order?
3) What would be the simplest, not the most elegant way to calculate LEQ?

hp 20.6
hp 20.6
hp 107.7
hp 737.9
lp 1200
lp 1200

Thank you,


W.

Re: Weighted Sound and LEQ

Posted: Sat Oct 07, 2017 11:19 am
by steve
waverlye wrote:1) Is this the order in which the data will pass
Edgar's code nests multiple filters inside each other:

Code: Select all

(lp (lp (hp (hp (hp (hp s-in 20.6) 20.6) 107.7) 737.9) 12200) 12200)

Code: Select all

(lp
  (lp
    (hp
      (hp
        (hp (hp s-in 20.6)
            20.6)
        107.7)
      737.9)
    12200)
  12200)
which means that the two low pass and 4 high pass stages are cascaded - the order is unimportant.
waverlye wrote: 20.6 and 1200 are used twice in a row. Should I take this to mean this is the equivalent of a 2nd order filter and all other reference are 1st order?
Yes.
The second order filters could be written as (lowpass2 sound frequency), but due to implementation details, the first order filters cascade better than using the 2nd order versions.
waverlye wrote:3) What would be the simplest, not the most elegant way to calculate LEQ?
Not at all simple with Audacity because LEQ is about sound pressure levels, and Audacity only knows about signal level. For sound pressure measurements you need a calibrated system, which means that you need a sound level meter of some kind - in which case, the simplest method is to use a sound level meter that supports LEQ measurement.

Re: Weighted Sound and LEQ

Posted: Mon Oct 09, 2017 6:06 pm
by waverlye
>>which means that the two low pass and 4 high pass stages are cascaded - the order is unimportant.
Hmm. I would have thought the order was important because if I started with passing 737.9, would I implicitly attenuate lower frequencies?

>>The second order filters could be written as (lowpass2 sound frequency), but due to implementation details...
Wonderful, I was hoping I understood that correctly.

>>Not at all simple with Audacity because LEQ is about sound pressure levels, ...
Ah, I've run into that issue again. The sound pressure level seems to be at the bottom of a number of my issues.

Thank you for indulging me on this issue.
It was very much appreciated.


W.

Re: Weighted Sound and LEQ

Posted: Mon Oct 09, 2017 6:41 pm
by steve
waverlye wrote:>>which means that the two low pass and 4 high pass stages are cascaded - the order is unimportant.
Hmm. I would have thought the order was important because if I started with passing 737.9, would I implicitly attenuate lower frequencies?
Perhaps I can explain that more clearly...

We are using two types of filter, 1st order low pass and 1st order high pass. The function names are "lp" and "hp" respectively.
Each filter takes two arguments (two parameters), the first is the sound that the filter is applied to, and the second is the corner frequency of the filter.
So the two functions are:
(lp <sound> <frequency>)
and
(hp <sound> <frequency>)

So yes the <frequency> parameters need to match up with either a "hp" command or an "lp" command, but the order in which we cascade does not matter.

Code: Select all

(hp
  (lp <sound> <x_Hz>)
  <y_Hz>)
is identical to:

Code: Select all

(lp 
  (hp <sound> <y_Hz>)
   <x_Hz>)

Re: Weighted Sound and LEQ

Posted: Thu Oct 12, 2017 1:19 pm
by waverlye
Understood.

Thank you,


W.