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.

## Weighted Sound and LEQ

**Forum rules**

**If you require help using Audacity, please post on the forum board relevant to your operating system:**

Windows

Mac OS X

GNU/Linux and Unix-like

### Re: Weighted Sound and LEQ

Edgar's code nests multiple filters inside each other:waverlye wrote:1) Is this the order in which the data will pass

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)
```

Yes.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?

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.

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.waverlye wrote:3) What would be the simplest, not the most elegant way to calculate LEQ?

9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

### Re: Weighted Sound and LEQ

>>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.

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

Perhaps I can explain that more clearly...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?

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>)
```

Code: Select all

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

9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

### Re: Weighted Sound and LEQ

Understood.

Thank you,

W.

Thank you,

W.