Unwanted volume normalization

I’ve recorded some clips. Give me a few minutes to edit and upload them.

This clip is with audio going trough hdmi, no compression:

drive.google.com/file/d/0ByXVP_FdtPH7bE5paHh3YjAxeXc/view?usp=sharing

This through hifiberry, compression:

drive.google.com/file/d/0ByXVP_FdtPH7TFRJbzZ3Y3c4N0k/view?usp=sharing

Please note this was done by putting mi cell phone close to the headset, the effect isn’t as noticeable as directly in your ear.

But I want the source file so I can replicate your results here.

drive.google.com/file/d/0ByXVP_FdtPH7cDB3R2VwQVhQZFU/view?usp=sharing

here

(you can download it if you want)

Can you also provide some version information about OSMC?

cat /etc/os-release
cat /proc/version
dpkg -l | grep mediacenter-osmc

cat /etc/os-release

PRETTY_NAME=“Open Source Media Center”
NAME=“OSMC”
VERSION=“January 2017”
VERSION_ID=“2017.01-1”
ID=osmc
ID_LIKE=debian

ANSI_COLOR=“1;31”
HOME_URL=“http://www.osmc.tv
SUPPORT_URL=“http://www.osmc.tv
BUG_REPORT_URL=“http://www.osmc.tv

cat /proc/version

Linux version 4.4.27-7-osmc (root@vero2a) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 SMP PREEMPT Tue Jan 24 03:38:31 UTC 2017

dpkg -l | grep mediacenter-osmc

ii rbp2-mediacenter-osmc 16.1.0-27 armhf Media Center package for OSMC

Sorry for the delay. I’ve played the clip under VLC and saw it reduce the volume, complete with on-screen display showing the reduction. Then I changed the volume and selected the sound device for the hifiberry without software processing and I’ve not seen any reduction again, even with gains greater than 1.

VLC ran poorly with my configuration, so I extracted the audio as a WAV file - see here: https://drive.google.com/file/d/0B_P-i4u-SLBXLWt4eFJLTjUxNUE/view?usp=sharing

I’m convinced that ALSA isn’t forcing any form of normalisation or dynamic range compression. Can you try playing the above WAV file with the simplest tool possible (aplay is the obvious choice)?

For the record, I’m not surprised that sophisticated audio processing takes exception to that clip. Audacity identifies three consecutive samples with the absolute smallest possible value (-32768) on both channels. Note that there is one more position below zero than above - you can’t store +32768 in a signed 16-bit integer - so this really is abnormally loud.

Pelwell, thanks a lot for your efforts here!

I’ve played the wav with aplay, by command line, KODI stopped, and same result. Compression.

Please unserstand that this video clip has nothing in particular, just happened to be the series I was watching at the time I posted. But it’s the same with any video (or, having tested mp3 & wav, apparently any audio file as well). In action scenes I have to turn the volume pretty much up, and later down before plain dialogue blows my ears. And it doesn’t matter if it’s a downmixed 5.1 DTS or a stereo AC3-AAC.

It’s more noticeable with high-pitched sudden noises, like a crack or a snap.

What’s odd, now that I think of it, it’s that I haven’t noted the annoying volume increase during silent scenes that video players with normalization/compression on make, producing that SSSSSSSSS from the bakground noise and making you jump when an actual sound enters, before the level is adjusted again… Through hifiberry it only appears to put the volume down after louder peaks, but not to putting it up during lower ones…

Could there be some overflow if the volume is too high?

Based on everything you’ve said, I think the normalisation is happening in the amplifier. Although the same source material is being fed to all three outputs, the analogue output level may be different. Have you tried turning down the DAC+ volume? Note that the DAC+ volume goes up to 123% - i.e. you can have gain > 1. Try with ALSA volume at 100%, or perhaps start at 90% and see if it makes a difference. You could use the alsamixer tool if it’s installed, just be sure you are using the right volume control.

Well, I think that trying to follow your advice I made an interesting discovery.

I had set “mantain original volume on downmix” on. My mistake. I thought that meant leaving it alone, no compressing it, something like that; it was the opposite. It compresses audio, but, supposedly, only on video, only on 5.1, right? So, since my problem was with stereo videos too, and music, I didný pay much attention to that. Till now.

I turned it off. Suprise! No more normalization!! On my stereo videos!! But, as I’ve tested up to now:

  1. As I’ve said, it affects stereo videos.
  2. It ONLY affect video playback. When I play the extracted audio track as mp3 or wav, as music in kodi, or stopping kodi and trough mplayer or aplay: COMPRESSION!!
  3. When turned this “mantain…” off, the volume is much lower (as expected). But again, only in videos. In music/mplayer/aplay, the audio keeps the gain.

It’s like: hifiberry by default normalizes; it only stops when you set not to do it in audio output preferences (but only works on videos).

Odd, isn’t it?

And I don’t think it’s something specific to my system. I have the most basic eveything, never installed any fancy nothing. Just plain OSMC, and it’s acting like that…