HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - Tech => Topic started by: airtas on 2022-09-19 15:20:45

Title: are the thin blue lines above 16khz good?
Post by: airtas on 2022-09-19 15:20:45
are the thin blue lines above 16khz good or could they be artifacts?
Title: Re: are the thin blue lines above 16khz good?
Post by: radorn on 2022-09-19 16:13:58
I'm only guessing, but, since those are MP3s, and there's a clear cutoff at 16kHz, I would say the encoder that produced the file with the "spikes" was trying to preserve some high-frequency detail that it considered relevant during these passages, while discarding everything else.
As I understand it, for most lossy codecs, stuff avobe 16kHz is mostly considered superfluous for transparency, and much less bandwidth is dedicated to it compared to what's below 16kHz. The exact parts discarded will vary a lot depending on codec, settings, and, of course, what's in your source.
Title: Re: are the thin blue lines above 16khz good?
Post by: itisljar on 2022-09-19 18:02:17
OP, can you even read the graph? On the right you have explanation of colors, how loud are they. Blue is 80 dB below zero, so it's mostly noise you won't hear. Above cut frequency they're probably artefacts you won't hear anyways, as most of the signal you hear goes up to some 10 kHz (red, yellow and green).
Title: Re: are the thin blue lines above 16khz good?
Post by: Eurobeat_fan on 2022-09-19 18:16:32
I'm only guessing, but, since those are MP3s, and there's a clear cutoff at 16kHz, I would say the encoder that produced the file with the "spikes" was trying to preserve some high-frequency detail that it considered relevant during these passages, while discarding everything else.

I think this is the correct answer here. If I didn't see the graph, I would say that this is clipping, but I think these are the rare cases where encoder tried to preserve HF.
Title: Re: are the thin blue lines above 16khz good?
Post by: Porcus on 2022-09-19 18:56:54
If the encoder doesn't have any ambition of being correct above 16 kHz, then I wouldn't worry about artefacts up there as long as they aren't worse than silence ...

But what are the peaks? There is no need for an mp3 encoder to avoid clipping if the clips are inaudible.  An inaudible overshoot from a non-clipping original, is an acceptable artefact.  And an encoded overshoot that is clipped to an inaudible ceiling is also an acceptable artefact.
Title: Re: are the thin blue lines above 16khz good?
Post by: rutra80 on 2022-09-21 11:44:09
If the music is old (looks like 2000?) I'd say it's vertical retrace of some CRT monitor in the studio.
Title: Re: are the thin blue lines above 16khz good?
Post by: radorn on 2022-09-21 17:14:33
If the music is old (looks like 2000?) I'd say it's vertical retrace of some CRT monitor in the studio.
I almost gave the same answer at first, but he's talking about what's above 16kHz, not below (look at the second picture), so he's not talking about the 15.7 kHz horizontal (not vertical) deflection coil whine.
Title: Re: are the thin blue lines above 16khz good?
Post by: danadam on 2022-09-21 23:36:41
I'm only guessing, but, since those are MP3s, and there's a clear cutoff at 16kHz, I would say the encoder that produced the file with the "spikes" was trying to preserve some high-frequency detail that it considered relevant during these passages, while discarding everything else.
Yes, as I understand from https://wiki.hydrogenaud.io/index.php?title=High-frequency_content_in_MP3s the encoder will not sacrifice the quality of lower frequencies to keep higher frequencies. This would mean that the spikes are the only places where there was still some "bitrate" left to encode the high frequencies.
Title: Re: are the thin blue lines above 16khz good?
Post by: rutra80 on 2022-09-22 08:20:19
I almost gave the same answer at first, but he's talking about what's above 16kHz, not below (look at the second picture), so he's not talking about the 15.7 kHz horizontal (not vertical) deflection coil whine.
Ahh, those vertical lines on 2nd picture is clipping most probably.
Title: Re: are the thin blue lines above 16khz good?
Post by: magicgoose on 2022-09-22 08:55:19
horizontal lines = a tone that's always humming mostly at a consistent frequency
vertical lines = short, broadband clicks or similar sounds, but unless you really zoom in, legit sounds like percussion can look the same. (also when examining click-like sounds, it's often very informational to also check the waveform graph, if it's clipping, then it gets really obvious in the waveform)

as you can guess, neither of these are good, but whether or not it actually matters, that's a different question, that usually can't be answered just by looking at pictures.
Title: Re: are the thin blue lines above 16khz good?
Post by: danadam on 2022-09-22 14:12:15
Ahh, those vertical lines on 2nd picture is clipping most probably.
Wouldn't it go up to 22 kHz if it was clipping?
Title: Re: are the thin blue lines above 16khz good?
Post by: shadowking on 2022-09-23 16:45:45
Judas priest  - rising from ruins

Similar spikes with 192k  vbr,  abit less with cbr
replaygain -10.26
Title: Re: are the thin blue lines above 16khz good?
Post by: danadam on 2022-09-23 21:04:47
I took "Iron Maiden / 2002 - Rock In Rio / 2-06. The Number Of The Beast" and converted it with "lame -V2", then I reduced the volume of the original by 1.3 dB and converted again. The peaks of the mp3 files, as per:
Code: [Select]
ffmpeg -i INPUT -af astats -f null /dev/null
are +0.96 dBFS and -0.11 dBFS. The spikes on spectrogram go up to 22 kHz:
XX

Then I converted the quieter version with "lame -V2 -Y". AFAIK "-Y" tells lame to "sacrifice" higher frequencies (above 16 kHz) if lower frequencies need more bits and it is on by default in CBR mode. One could say we get spikes too, but they go only to 19 kHz:
X
Title: Re: are the thin blue lines above 16khz good?
Post by: magicgoose on 2022-09-25 12:23:25
@danadam what happens if you decode the louder mp3 while reducing gain, and plot the graphs of that?
I have a hunch that (most of) this clipping visible on the first picture, happens only because the plotting tool can't read values larger than 1.0. Because MP3 is (in theory) capable of representing peaks above 1.0. But there is a lot of software which assumes nothing can exceed 1.0 and it'll clip it.
Title: Re: are the thin blue lines above 16khz good?
Post by: danadam on 2022-09-26 20:14:03
I have a hunch that (most of) this clipping visible on the first picture, happens only because the plotting tool can't read values larger than 1.0. Because MP3 is (in theory) capable of representing peaks above 1.0. But there is a lot of software which assumes nothing can exceed 1.0 and it'll clip it.
Yes, I created the spectrograms using SoX, which operates on integers. The spectrogram of wav decoded with lame looks very similar to the first one from previous post:
X

When I decode with ffmpeg, which operates on floats, and reduce the volume before saving as 16-bit wav:
Code: [Select]
ffmpeg -i INPUT.mp3 -af volume=-1dB,aresample=dither_method=triangular OUTPUT.wav
then I get the spectrogram similar to the second one from previous post.
X

Spek seems to operate on floats, so doesn't have the problem with clipping:
X

although I had to increase the window size to 16K to get a similar look like with SoX. With the default 2K the high frequencies look very sparse:
X
Title: Re: are the thin blue lines above 16khz good?
Post by: vina54 on 2023-11-18 01:15:04
The second picture looks very similar to either what Helix MP3 or LAME -Y switch does. I think this quote from the LAME Hydrogen Audio Wiki describes it the best
Quote
It allows high frequencies (>=16Khz) to exist, it just alters its accuracy. If their values are very small it can quantize them to zero (but probably the psychoacoustic analyzer will decide to simply remove them instead).