Unwanted volume normalization

Hi. Sorry for my poor english.

I have a RPi3 running OSMC, with a sound card: Hifiberry DAC+.

If I set the main RPi audio jack output, and/or through HDMI, it’s all right. But when use the Hifiberry output, during video playback, the volume gets normalized, which I don’t like and is very annoying.

I’ve asked for help in the Hifiberry support forum. Their answer:

The DAC+ does not modify the data send from the application. There is no normalization in the driver or the hardware. If OSMC does this, you have to get in touch with the OSMC developers.

I understand that OSMC doesn’t have a menu option to turn normalization on/off anymore; correct?

I’ll appreciate any help. Thank you.

Make sure “amplification” is set to zero on video OSD setttings. http://kodi.wiki/view/video_playback

What is Hifiberry DAC+ connected to? An AVR? Do you have passthrough enabled? Is normalisation enabled on AVR? (May be called night or midnight mode).

Amplification is set to zero, yes.

The DAC+ is connected to an amplified headset. First test I made was to connect the same device, no touching any OSMC configuration, to each output, and:

setting “PI: HDMI” / TV audio jack output = no normalization
setting “PI: Analogue” / RPi audio jack output = no normalization

setting “ALSA: Default (snd_rpi_hifiberry_dacplus analog)” / DAC+ audio output = normalization

Could the headphone do this?

No. It’s the same headphone I connect to each output. Same connection. Same everything.

By the way, the same happens if I connect speakers instead of this headphone. I’ve tested that too.

Does this occur just with video, or with music (e.g. mp3) too?
Does it only occur with source is multichannel (e.g. 5.1)? Or do you get the same issue when source is stereo?

Does “maintain original volume on downmix” (system/audio settings) enabled/disabled affect it?

Just to be 100% sure, I extracted the audio track from the video I was using to test, it was a stereo AC3, converted it to mp3 and played it like music. And yes, ALSA normalized it, HDMI / Pi analogue didn’t.

That answers your other questions too. Number of channels, downmixing settings, etc. are not relevant, because simple mp3 stereo files get normalized.

Is there any ALSA specific config file or something like that? I wonder.

Can you rule kodi out?
stop kodi and play the mp3 file a simple mp3 player (mplayer or mpg123).
Or even convert to wav and play with aplay which is very minimal.

Well, I stopped kodi, installed mplayer and played the mp3.

Normalized.

Okay not a kodi issue.

Either ALSA, Hifiberry or headset.

I agree with Hifiberry - it is not in the kernel driver.
I’m pretty sure ALSA isn’t doing this. Are you using alsa directly (rather than pulseaudio?)
I’m wondering if it could be the headset.

Perhaps Hifiberry outputs a louder signal level that triggers something in headset?
Does reducing volume in kodi stop the problem?

I don’t really think the headset has nothing to do. If I plug it to the tv or rpi audio jack, no normalization at all. If I plug speakers to the hifiberry output: normalization.

I don’t even know what is pulseaudio. I just put together RPi & DAC+, installed OSMC in the sd card and that’s all. Everything worked fine from start --except for this normalization thing.

Did you install the experimental bluetoothstreaming?

Does lowering the volume in the alsamixer or kodi make a difference?

No, I didn’t install nothing at all. Just basic plain OSMC.

No, it doesn’t depend on the volume. Everytime something like a blow or an explosion happens, the volume drops in half for several seconds, whatever the initial level was.

Power issues probably? Not enough capacity for the dac on the hifiberry could cause this.
Try a bigger powersupply.

It’s powered enough, for sure.

Can you explain exactly what you mean by normalisation - what is being normalised with respect to what? I’m familiar with the concept, but I want to be sure we are on the same wavelength. Be careful to explain the difference between normalisation and a static volume offset.

Please say what you do to demonstrate this normalisation, what you expect to happen, and what actually happens. If you can post a link any short sample clips (for testing purposes only, to be deleted afterwards), or email them to me at phil@raspberrypi.org, that would be appreciated.

Having said that, neither mplayer nor ALSA nor the HifiBerry driver nor the codec driver will be doing any normalisation. The hardware codec itself might, but I’d be surprised if it did.

From his previous post I think he means compression or limiting rather than normalisation.
He said if the source audio gets louder, the output volume lowers.

Normalization (I’m not sure I’m using the exact technical terms here, I hope you’ll understand the idea) is what happens when the dymamic range, I mean, the difference between the higher and lower parts, e.g. explosions / silence, is compressed (via soft or hardware) so that difference is not so large. The idea is that way you don’t have to be turning down the volume during action scenes --or waking your neighbours up. That’s the reason I use headphones, problem solved, no normalization needed.

I’m not an expert in RPi nor ALSA nor OSMC but know very well this effect, you can turn it on/off in any video player. It works like this: scene with music, level 10, so to speak, a gun fires, that sound makes the music drop to 5, lowly increasing back to 10 in some seconds --unless another sound makes it drop again. Is it clear?

I could upload a clip, but normalization depends on the playback system, not the video itself. I should record it with an external mic to show the difference.

Yes, mcobit, its compression, but most video players call it normalization --in the PotPlayer I use in wondows, it’s called “normalizer”.

OK, so we’re talking about dynamic range compression/limiting. I wanted a test clip so that I can try to reproduce the problem here - I have a HiFiBerry DAC+ and a storage oscilloscope.