Distortion on export wav at 16 bit, 44.1 kHz

Hi,
i am working with Jack set to 44100 samplerate.
When i export at 24 bit, wav file, the sound is perfect everywhere but when i try to export at 16 bit, 44.1 kHz, wav file, the sound on VLC is terrible (i can hear distortions).
If i try to re-import the 16 bit wav file on Ardour it sounds good…
On the Master bus i have just a Tap Scaling Limiter: http://tap-plugins.sourceforge.net/ladspa/limiter.html
Can you help me to export at 16 bit without distortion? Thanks.

Could it be that the 24bit format has normalization enabled, while the 16bit export preset has not?

The 24 bit preset has not the normalization activated; the 16 bit preset has the normalization activated (i tried also without normalization but the issue persists).
I tried also a conversion (just with Sound Coverter) to 16 bit and 48 samplerate and all seems fine but not at 44.1…

Can you use something like Audacity or mhwaveedit, or even just aplay, and see if the file sounds OK?
I wouldn’t be surprised if there’s a bug in your VLC.,

A wave editor, like the two first ones, should also give you a visual clue if there really is digital distortion in the file.

good point. sndfile-info /path/to/the/file.wav is also a good start.

With Audacity and aplay the 16 bit, 44.1 kHz exported wav file sounds good without distortion/noise.
VLC is 3.0.8 version if can help.
Here is my sndfile-info:

========================================
File : Intro.wav
Length : 43537440
RIFF : 43537432
WAVE
fmt : 16
Format : 0x1 => WAVE_FORMAT_PCM
Channels : 2
Sample Rate : 44100
Block Align : 4
Bit Width : 16
Bytes/sec : 176400
data : 43537396
End


Sample Rate : 44100
Frames : 10884349
Channels : 2
Format : 0x00010002
Sections : 1
Seekable : TRUE
Duration : 00:04:06.811
Signal Max : 32767 (-0.00 dB)

That makes it clear that ardour and the file itself are fine and the problem is in VLC.

3.0.10 is the latest VLC version so you could install that and see if there’s any difference.

There’s also a chance there’s some VLC setting, and not a bug, that’s causing the problem.
You should have its current configuration files in ~/.config/vlc .
Close VLC, run mv ~/.config/vlc ~/.config/_vlc and then start the program again, with the default settings, and see if the distortion persists.

TAP Scaling Limiter is broken and there is no way to fix it. I reported this to the author a couple of years ago. The limiter tries to find half cycles and operate on those but the concept does not work.

If I remember correctly the plugin has a small size buffer to reduce latency to minimum. The plugin tries to find and fit half waves of audio into it. Sometimes half waves are much longer than what the buffer can hold and then limiting is done onto an incomplete half cycle. This creates a sharp spike at the border of two buffers of audio data. I got the plugin to create spikes in audio just by limiting a long sine wave.

The author fixed what he could but he could not completely fix it because the principle is broken. Just use another plugin.

https://sourceforge.net/p/tap-plugins/bugs/7/

Ok, tomorrow i will try the new VLC version and my actual version with clean configuration and i will let you know.
Meanwhile, please, can you suggest me a simple and functional limiter for my Master bus? thanks in advance.

From what I understand LSP, x42 and Zam all have good quality plugins, including limiters.
I can’t say if any one is better than the other but here are are the relevant links

https://lsp-plug.in/?page=download

http://www.zamaudio.com/?p=976

2 Likes

I can personally vouch for both the x42 limiter and Loudmax (if you need inter-sample peak detection). I’ve used them on plenty of projects at this point with transparent results shaving off 1-3 dB here and there. I’ve not tried the LSP limiter as yet but I hear great things about it.

1 Like

For reasons unknown, VLC here has a default gain of 150%, so when the file is normalized (Signal Max : 32767 (-0.00 dB)) It will clip on playback, unless you set the volume to 100% or less.

Perhaps that’s all there is to it?

1 Like

Just for the record here is a screenshot of what happens to a 200 Hz sinewave after limiting it to -6 dBs with Tap Scaling Limiter. You can definitely hear that as added harmonics and distortion.

Tried vlc with clean configuration and the latest version of vlc: both times distortions/noise (volume 100%).
Tried also audacious and sounds good as aplay, ardour and audacity.
I choose lsp limiter, very complete and great plugin.
So, seems a vlc bug? is someone interested to ask a fix to vlc developers?

Hmmm,

How have I missed this limiter?? Is it not part of the x42 plugins set?

No, it is from the LSP plugins set

The x42 limiter is on Robin’s x42 front page and the initial github check-in is from June 2018, so idunno. :slight_smile:

GMaq was referring to the x42 limiter I linked to earlier.

It is. The limiter was added to the x42-plugins set on 2018-08-03 (available in debian/buster, current stable), and the compressor in the 2019-04-29 release.

Wow, that does look bad. Seems like release happens immediately without the gain being smoothed. It might be worth filing a bug report for that.