Checking for clipping through CLI - inconsistencies

Still new to all of this? Feel free to post in any of the subforums on this site, but in this subforum newbie questions are especially encouraged!

Moderators: MattKingUSA, khz

Post Reply
User avatar
Valso
Established Member
Posts: 9
Joined: Mon Mar 13, 2023 12:53 pm
Location: Sofia, Bulgaria
Has thanked: 1 time
Contact:

Checking for clipping through CLI - inconsistencies

Post by Valso »

Hi, everyone. I'm not a musician but you could say I'm an audiophile cuz I want everything to be in the highest possible quality. Recently I noticed some of my music has clipping, so using Audacity I fixed them (some of them even became perfect, as if there was never any clipping). But I wanna check ALL of my music (which is 65GB+ all in WAV format). Through internet search I found this forum and to be precise - this old topic: viewtopic.php?t=15359 But these scripts in the topic don't work at all, so I kept looking and came across this (the screenshot is from DuckDuckGo):

Image

You'd think I've found the answer... BUT! The above screenshot says that the file can have its volume increased by the number of volume adjustment without causing any clipping. However, checking a WAV track with Audacity, it already has clipping (the red color is clipping). According to this:

Code: Select all

[rado@arch]: /media/1000GB/MUSIC/WAV/HIP-HOP/BUSTA RHYMES>$ sox "Busta Rhymes - You Got It.wav" -n stat
Samples read:          19877928
Length (seconds):    225.373333
Scaled by:         2147483647.0
Maximum amplitude:     0.999969
Minimum amplitude:    -1.000000
Midline amplitude:    -0.000015
Mean    norm:          0.430396
Mean    amplitude:    -0.000396
RMS     amplitude:     0.541564
Maximum delta:         1.999969
Minimum delta:         0.000000
Mean    delta:         0.073677
RMS     delta:         0.128976
Rough   frequency:         1671
Volume adjustment:        1.000

that song can be volume increased without clipping by 1 dB. But since it already HAS clipping, I don't see how that will help. Something here doesn't fit but I'm lost and I need some help to figure it out. Is it possible that "volume adjustment" displays the wrong digit and it should be -1, instead of +1?

This is what the track looks like in Audacity, when the option to display clipping is ON:

Image

These red lines make me seriously doubt that increasing the volume by even +1 would do any good and will most probably make things even worse.

Image

User avatar
Impostor
Established Member
Posts: 1332
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 344 times

Re: Checking for clipping through CLI - inconsistencies

Post by Impostor »

If the following is true, then there seems not much you can do:

[headroom 9dB] Note that this wisdom seems to have been lost in modern music production; in fact, many CDs, MP3s, etc. are now mastered at levels above 0dBFS i.e. the audio is clipped as delivered.

{from https://www.scrc.umanitoba.ca/doc/scrchelp/man/sox.html}

Insanity!

By the way, numbers without units don't tell you anything at all, physically speaking.

User avatar
Impostor
Established Member
Posts: 1332
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 344 times

Re: Checking for clipping through CLI - inconsistencies

Post by Impostor »

-v, --volume FACTOR
Adjust volume by a factor of FACTOR. This is a linear (amplitude) adjustment, so a number less than 1 decreases the volume; greater than 1 increases it. If a negative number is given, then in addition to the volume adjustment, the audio signal will be inverted.

{from sox manpage}

So -v gives a multiplication factor. 1 means unchanged.

And these:

Maximum amplitude: 0.999969
Minimum amplitude: -1.000000

give the fractions of the max amplitudes(pos/neg) w.r.t. the max. possible one. So your file is already normalized to the max.

User avatar
sysrqer
Established Member
Posts: 2519
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 319 times
Been thanked: 148 times
Contact:

Re: Checking for clipping through CLI - inconsistencies

Post by sysrqer »

I'm not sure about your example but have you looked at True Peak? As far as I understand it there can be very small peaks at the sample level and perhaps confusing results you're getting have something to do with this. I think that not all peak-readers detect them but it's a bit of a rabbit hole.

User avatar
Valso
Established Member
Posts: 9
Joined: Mon Mar 13, 2023 12:53 pm
Location: Sofia, Bulgaria
Has thanked: 1 time
Contact:

Re: Checking for clipping through CLI - inconsistencies

Post by Valso »

I had never heard of True Peak (until now). If I'm reading this right, this song is flooded with clipping.

Image

Image

User avatar
sysrqer
Established Member
Posts: 2519
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 319 times
Been thanked: 148 times
Contact:

Re: Checking for clipping through CLI - inconsistencies

Post by sysrqer »

It appears to, it's very loud loud mix.

User avatar
Valso
Established Member
Posts: 9
Joined: Mon Mar 13, 2023 12:53 pm
Location: Sofia, Bulgaria
Has thanked: 1 time
Contact:

Re: Checking for clipping through CLI - inconsistencies

Post by Valso »

This song is a mission impossible! I tried everything, including reducing the Bass to -20 and it still clips... Image

If you want I can upload it somewhere, so that one of you tries their magic, cuz I'm totally out of ideas what else to try.

Image

User avatar
Impostor
Established Member
Posts: 1332
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 344 times

Re: Checking for clipping through CLI - inconsistencies

Post by Impostor »

Valso wrote: Tue Mar 14, 2023 12:31 am

This song is a mission impossible! I tried everything, including reducing the Bass to -20 and it still clips... Image

If you want I can upload it somewhere, so that one of you tries their magic, cuz I'm totally out of ideas what else to try.

If there's clipping in the source then reducing amplitude won't magick it away, except for one very special case when the clipping occurs between two successive samples only. But maybe there exists some smart algorithm which can smooth the peaks out after the amplitude has been reduced?

Or just buy that music on vinyl :)

To demonstrate:

Generate a pure tone of 100Hz, 1s duration, at -3dB peak level. Frequency analysis in lowest figure. Boundary effects are visible in the spectrum: if the signal were infinitely long, we'd get an infinitely sharp peak at 100Hz, but the signal is only 1s long.

Next, amplify the signal with +8dB. The the resulting wave is clipped. Frequency analysis below, left.

Now make sure the wave editor works destructively, otherwise the next step just reloads the original wave: amplify the signal, this time with -8dB. You'll see cut-off peaks. The frequency analysis of this wave is seen below, right:

As you can see, the the same higher-than-100Hz frequency peaks occur in the signal after reducing the amplitude of the clipped signal.

Moral of the story: Simply reducing the bass of a clipped signal will definitely not rid you of the clipping, since clipping introduces higher frequency peaks!

Attachments
Left0dB_Right-8dB.png
Left0dB_Right-8dB.png (41.91 KiB) Viewed 1264 times
Pure.png
Pure.png (29.16 KiB) Viewed 1264 times
User avatar
Valso
Established Member
Posts: 9
Joined: Mon Mar 13, 2023 12:53 pm
Location: Sofia, Bulgaria
Has thanked: 1 time
Contact:

Re: Checking for clipping through CLI - inconsistencies

Post by Valso »

If I could buy it (on an audio CD, I don't have a record player nor I like vynils), I would have. But I heard contradicting reviews about the only site where that CD is available (discogs.com) + the price isn't for my pocket. On top of that at some point there was an inscription "we don't deliver to your location". That CD is some kind of unofficial never released collaboration between Busta Rhymes and DJ Grind named "Gifted and Blessed" or something similar.
With them not delivering to my country, that leaves me only with finding the music from torrents, which I did years ago and try to minimize the clipping. The problem is that the same methods which worked for other songs, here do little to nothing. I reduced the bass only as an attempt to see what will happen because I ran out of other ideas.

For another old song (again from torrent bc Disney only cares about supplying capitalistic countries) by Hans Zimmer - Just Good Business (soundtrack of "Pirates of the Caribbean), it used to look a lot worse than the screenshot above - 100% of the track was covered in red color, not a single blue color was visible. After I used "Clip Fix" on Audacity and then added very little Loudness Normalization, now it's perfect, with almost zero clipping (there are still 2 red lines but they're inaudible) and looks like this:

Image

Basically the entire collection of POTC soundtrack had a lot of clipping and using the same methods I used for "Good Business", now they're all perfect, most of them don't have even a single red line and yet they're still normalized enough not to cause any clipping. So I was hoping that using the same methods on Busta Rhymes' song would work but they didn't. A friend of mine said that the song was probably so badly normalized out of all scales that I'd have to shrink the spectrum to a thin line in order to be listenable without clipping.

Image

User avatar
Impostor
Established Member
Posts: 1332
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 344 times

Re: Checking for clipping through CLI - inconsistencies

Post by Impostor »

Valso wrote: Tue Mar 14, 2023 4:38 pm

A friend of mine said that the song was probably so badly normalized out of all scales that I'd have to shrink the spectrum to a thin line in order to be listenable without clipping.

Your friend's probably right. Normalization should be used to get optimal loudness levels, without distorting the signal. If I need to amplify a signal even more, and only a modest amount of peaks are in the way, I use a limiter to dampen only those peaks, and then normalize to at most -.3dB (kind of arbitrary). If there are too many such peaks though, only re-recording can help.

User avatar
Impostor
Established Member
Posts: 1332
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 344 times

Re: Checking for clipping through CLI - inconsistencies

Post by Impostor »

Valso wrote: Tue Mar 14, 2023 4:38 pm

But I heard contradicting reviews about the only site where that CD is available (discogs.com)

I personally have had only good experiences with discogs. Of course, that totally depends on the seller.

User avatar
Valso
Established Member
Posts: 9
Joined: Mon Mar 13, 2023 12:53 pm
Location: Sofia, Bulgaria
Has thanked: 1 time
Contact:

Re: Checking for clipping through CLI - inconsistencies

Post by Valso »

After a lot of experimenting, I think I finally learned how to fix clipping bc now formerly clipped tracks sound just like they should (loud and clear), only without the clipping. And so, I decided to give that problematic song another go (the one from the first post - Busta Rhymes & DJ Grind). Even after fixing it at 100% - not a single clipping line, even the clip meter on the toolbar of Audacity reads absolutely no clipping - that track is still not just clipping, it's quite literally farting. Flat equalizer, soft equalizer, full trebble equalizer - it farts and that's it. I think it's just a matter of a very bad mixing and whoever did it, was both drunk and high on the worst possible drugs and alcohols on the planet. :lol:

This is the track fixed. I've named the archive that way bc I'm not sure whether Google won't delete it, if I name it with the artist and the song title (Busta Rhymes & DJ Grind - You Got It).

https://drive.google.com/file/d/1tqXdbU ... sp=sharing

Image

Post Reply