Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: ISO 226:2003 based loudness compensation for ALSA (Read 6464 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ISO 226:2003 based loudness compensation for ALSA

Hello all,

I've stumbled across this forum many times in the past, when researching audio-related matters and most recently on the subject of loudness compensation, as I was considering the implementation of a loudness compensated volume control for ALSA (the Linux sound system).  You've had several interesting discussions on the matter, so some of you may be interested in the result, which you can find here.

I'm by no means an expert in DSP and haven't dabbled in it lately, so the implementation may be less than perfect.  Discussion, either on the theory of operation, or on the details of the implementation, is of course welcome.

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #1
Will try this out soon. I assume this can be used with PulseAudio?

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #2
Very interesting, I'll assume this is nothing like the loudnorm?
PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #3
Will try this out soon. I assume this can be used with PulseAudio?

I would assume so too, but I don't use Pulseaudio and I'm not very familiar with it.  It should be possible to load the 'loudness' PCM via something like:

Code: [Select]
pacmd load-module module-alsa-sink device=loudness sink_name=loudness sink_properties=device.description="Loudness"

I'm not sure how to play through it though, whether it's possible to somehow manipulate more than one controls with Pulseaudio, or whether this use-case is even supported.  I did consider making a Pulseaudio plugin as well, but the state of documentation of Pulseaudio's API, seems to be that it's basically non-existent, so I'll try to avoid that, as much as possible.

Very interesting, I'll assume this is nothing like the loudnorm?

Correct, this has nothing to do with loudness normalization.  I should have mentioned that specifically in the README.  The point of this plugin, is to compensate for the lost bass and treble content at lower volumes of reproduction.  The dynamic range and overall volume is not changed.

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #4
Correct, this has nothing to do with loudness normalization.  I should have mentioned that specifically in the README.  The point of this plugin, is to compensate for the lost bass and treble content at lower volumes of reproduction.  The dynamic range and overall volume is not changed.
Oh. I understood it completely wrong then. I thought this is going to allow me to listen to those podcasts where they shout at one point and then whisper the next and they don't even know what a compressor is, making it impossible to hear what the heck they're saying in a noisy environment or from a distance.

Since I keep the ALSA volume at 0db (100%) at all times and only change speaker volume, this would not do anything in my case.

The only case where I change volume in the PC itself, is changing the volume of specific applications. But that's a PulseAudio-only thing and I assume the ALSA plugin can't be used for that.

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #5
A few years back I designed an analogue version of this for the bass part of the compensation. It was pointed out to me by JJ and others that fixed compensation following the equal loudness curves is insufficient for correct compensation. Dynamic compensation, where the equalisation is dynamically adjusted according to the content, is required. This thread:
https://hydrogenaud.io/index.php/topic,92822.0.html
Regards,
   Don Hills
"People hear what they see." - Doris Day

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #6
A few years back I designed an analogue version of this for the bass part of the compensation. It was pointed out to me by JJ and others that fixed compensation following the equal loudness curves is insufficient for correct compensation. Dynamic compensation, where the equalisation is dynamically adjusted according to the content, is required. This thread:
https://hydrogenaud.io/index.php/topic,92822.0.html

I've followed that discussion, but although the argument for dynamic compensation sounds reasonable, when considered in a general sort of way, I'm not sure what exactly its theory of operation would be.  Say I wanted to make the compensation vary based on the current level.  I'd have to somehow calculate the current "loudness" and use that as a continuously varying reference level, but, setting aside practical considerations of how to implement that, from a DSP perspective, I'm not sure how that could be done in a meaningful way, in the absence of a standardized mastering process and reproduction environment, which would allow calculation of the actual SPL.  This has been pointed out in the thread you refer to, but if such "correct" compensation is not implementable, at least not in a useful way, in the general case, then the only question is whether static compensation, even if suboptimal, is nevertheless better than nothing.  In my experience so far, it does help, to varying degrees, depending on the material.  What was your experience with your implementation?

If it is somehow possible to practically implement varying compensation, in a way that would allow one to somehow circumvent the problem of not knowing the reference and current level, by adjusting one or more parameters by ear for example, I'd be interested in the details.

 

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #7
I agree, a static implementation is better than nothing.
I also agree regarding the difficulties due to the lack of standardised mastering. It's less of a problem for film, but even there Audyssey had to implement a user adjustable tweak. 
I didn't finish my prototype. I got as far as finding a source of the multi-gang pot, but my circumstances changed and I went to exclusive headphone listening, so listening at the "right" volume was always practical (and preferable).  Now I'm facing retirement so will have more time and opportunity for speaker listening. I'm going to dive into the research suggested in the old thread, and I'll follow your project with interest because in the intervening years it has become more practical to do it in software.
Regards,
   Don Hills
"People hear what they see." - Doris Day

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #8
nice, nice

I think this is neglegated too much in the audio world.
people spend 10000s of $ only to hear their system turn into a laptop speaker at low volumes.

I didn't try your plugin, but I tried these IRs in a convoler: https://hydrogenaud.io/index.php?topic=83607.msg722690#msg722690

Now, I use jack-server in Linux and I'm not sure I can make your plugin work with it!?

Also: where can I get the ISO data? I would like to create my own curves. txt files for REW would be perfect

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #9
I haven't had much experience with jack recently, but alsaloudness just poses as another PCM, i.e. another audio card.  Jack is layered on top of ALSA and is generally highly configurable, so you'll probably be able to direct it to output to the loudness-compensated PCM.

As for the contours, the relevant standard is, as you probably know, ISO 226, which comes in two revisions.  The latter seems to be available here.  The document contains both plots and the formulas to generate more accurate curves, depending on what you want to do.

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #10
I haven't had much experience with jack recently, but alsaloudness just poses as another PCM, i.e. another audio card.  Jack is layered on top of ALSA and is generally highly configurable, so you'll probably be able to direct it to output to the loudness-compensated PCM.

As for the contours, the relevant standard is, as you probably know, ISO 226, which comes in two revisions.  The latter seems to be available here.  The document contains both plots and the formulas to generate more accurate curves, depending on what you want to do.

Hi,
is there any intrest on your side to recieve a payment to make this a front-end app (lv2?, lin-vst?) and implent jack-audio?

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #11
is there any intrest on your side to recieve a payment to make this a front-end app (lv2?, lin-vst?) and implent jack-audio?

That would be difficult at the moment as for one I have my hands a bit full with other projects (and will have for a while, given the developing backlog) and for another, I'm not sure I'd be the right person to undertake this in the first place, having almost zero experience with LADSPA, Jack, or the things they're used for.

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #12
is there any intrest on your side to recieve a payment to make this a front-end app (lv2?, lin-vst?) and implent jack-audio?

I see. will look for another dev. thanks for reply

That would be difficult at the moment as for one I have my hands a bit full with other projects (and will have for a while, given the developing backlog) and for another, I'm not sure I'd be the right person to undertake this in the first place, having almost zero experience with LADSPA, Jack, or the things they're used for.

Re: ISO 226:2003 based loudness compensation for ALSA

Reply #13
is there any intrest on your side to recieve a payment to make this a front-end app (lv2?, lin-vst?) and implent jack-audio?

That would be difficult at the moment as for one I have my hands a bit full with other projects (and will have for a while, given the developing backlog) and for another, I'm not sure I'd be the right person to undertake this in the first place, having almost zero experience with LADSPA, Jack, or the things they're used for.

could you please have a look at this? https://github.com/sadko4u/lsp-plugins/issues/81
lsp-plugins dev is interested in making a plugin for this and it would be helpfull if you at least could provide the curves you calculated.
thanks