ΣSigmaStudio Ask AI Русский Log in

LKFS Metering

SigmaDSP & SigmaStudio TimothyHobbs Feb 13, 2024 00:00 4 replies Original on forum ↗
Subscribe
TimothyHobbs Question
Feb 13, 2024 00:00

I am looking into if it is possible to implement stereo LKFS Metering (or a close approximation of) in SigmaDSP.

Here is the standard: https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.1770-3-201208-S!!PDF-E.pdf

Is there an existing library for this? If not how would I go about implementing it?

There are 6 steps:

1. apply weighting EQ curve - this is easy with filter blocks.

2. gate the signal and only update the next step while signal is above threshold (to avoid periods of silence dragging down the average)

3. find the RMS level

4. average over a window of measurements (400ms or 3s) (the standard actually says you should use overlapping windows but I don't think that's necessary in my application)

5. sum the power of the channels together

6. convert to dB scale by taking the log.

I have not decided on a specific dsp chip to use yet, I am investigating the feasibility of a potential product design.

Any input is appreciated,

Timothy.

rms

Audio Signal Processors

adau1452

Audio Products

hardware

LKFS

adau1467

SigmaDSP Audio Processors

Show More

DaveThib Reply
Feb 13, 2024 00:00

Hello Timothy,

Funny you should post this today. Late last week I mentioned to a couple of people here in the company that we should develop a LUFS meter block for the Sigma300 parts. It is my understanding that this is a US standard and it looks similar to the LKFS you are asking about.

Yes, you should be able to get a decent approximation without too much trouble. I do not have a lot of suggestions right now because the document has a lot of information to absorb and then it will take some time to implement and test. At the moment I will not have time to delve into this too deeply.

You can find some envelope generator blocks that will be handy. You are correct the overlap is tough but it looks like it might be in time so it may be possible to setup a timer to switch the audio on and off to several envelope generators. What is handy about the envelope generators is that they do a lot of the work for you. It does the absolute value and the time constants for you. We have an RMS one so a lot of the work will be done for you.

We also have a block for easily converting to dB scale. I think you will have to use the ADAU1452 or the ADAU1467 family of processors to do this. It has the DSP processing power and some accelerators to make this easy to do.

Have you done any SigmaDSP development before? Your name seems familiar. Send me a friend request.

Sorry that I cannot whip up an example at the moment. If you can start getting the structure together I could make suggestions and there are others on the forum who also might like this challenge.

Thanks,

Dave T

KJBob Reply
Feb 19, 2024 00:00

Hello Dave and Timothy,

This is quite an interesting algorithm. Below is a semi-faithful attempt to implement it:

Filter -- like Timothy said, no problem. Even the IIR coefficients are provided. Often, published coefficients use different nomenclature compared to SigmaStudio -- so for example, the A and B coefficients may need interchanging, and / or the A coefficients negated. But not these, which makes me wonder if the author implemented this in SigmaDSP!

75% overlapping 400 mS RMS integration -- This is the heart of this algorithm. It's a bit much to implement, so I simplified it to one 100 mS integration feeding a four-tap moving average FIR filter working at fs = 10 Hz. The result is quite similar to the original algorithm -- the filter averages over 400 mS, while a transition every 100 mS simulates the overlaps beginning and ending. The integrator works like the one in this thread. A 10 Hz clock drives the integrator and the FIR.

The algorithm sums the squared channel levels, according to the standard. This smoothly weighs the result in favor of the louder channel(s).

An interpolated log lookup table performs the dB function, with the final result at the Real-Time Display. The Format 'knob' must be set to 5.0. Multiply the y axis by 10 to read dB.

I wasn't sure how the gating is supposed to work so I'll leave that for others to figure out.

The schematic below is small, so download the project to see it. It runs on a ADAU1701MINIZ eval board. Why 1701? If it can be made to fit into a -1701, it can be developed for any SigmaDSP.

Of course, I'm not claiming that this project meet the specification. Since it's for measuring subjective levels, I don't know how to calibrate or evaluate it. It appears to saturate at about -3 dB. Also, squaring the input audio cuts your dB dynamic range in half. Testing shows that it does respond to its input in a way rather unlike the stock dynamic blocks. One curious observation is how it responds to pink noise. Most level meters "bounce" a bit with pink noise, even though our ears perceive a steady sound. This one produces a flat graph.

LKFS-01.zip

Best regards,

Bob

LKFS-01_sch.png
LKFS-01_sch.png
1423.Level-graph.png
1423.Level-graph.png
TimothyHobbs Reply
Feb 20, 2024 00:00

Hi Dave,

I don't have much experience with SigmaDSP, my background is in electronics, audio and live/installed sound.

LUFS and LKFS are used almost interchangeably in industry, ill have to look into exactly what the difference is.

Timothy.

TimothyHobbs Reply
Feb 20, 2024 00:00

Hi Bob,

Thanks for providing this.

I think the way the gating works is to freeze the output when the input level is below a small threshold to avoid periods of silence from dragging the average down.

In practice every implementation seems to be slightly different but here are two we can use to compare against.

https://www.orban.com/meter

https://youlean.co/youlean-loudness-meter/

Timothy.