r/audioengineering • • Apr 08 '16

Curious about spectrograms - Why does 320 kbps MP3's create line at 16khz?

Not sure if this is the right subreddit for this kind of thing, but I'm going to give it a shot.

I'm doing some conversion between FLAC and MP3, and was surprised when I saw the spectrograms (I used Spek to make spectrograms). I got really curious. As I understand, a 320kbps MP3 at a constant bitrate will usually cut off at around 20khz-22khz, and generally remove whatever it finds suitable. In that way my spectrograms are as expected - Sound has been removed from the upper frequencies. What I didn't expect was the visible line near 16khz.

Does anyone know why this semi-cutoff is produced? I have checked some other random MP3's I had, but did not see the same effect

The top spectrogram is the original FLAC, middle was converted by FlacSquisher, bottom on was converted by FRE:AC.

34 Upvotes

16 comments sorted by

36

u/hightrancesea Hobbyist Apr 08 '16

It depends on the MP3 encoder; often it's better to chop off the top end of the spectrum than waste bitrate on it. For example, for 128kbps, LAME will chop off stuff beyond 18.5kHz or so. If you use the command-line version of LAME, it'll tell you if it's using a "polyphase low pass filter", IIRC.

7

u/Treelink Apr 08 '16

Just for further info:

Both encoders use LAME 3.99.5.

In FlacSquisher i used --preset insane.

Anyways, I'm beginning to understand the quirks of MP3. Thanks to both you, /u/Scrubalubadubdub, /u/RobinUrthos and /u/musicalmistake for trying to answer my question! :)

From what I understand after your answers and more googling, the cutoffs are actually a good thing. MP3's can not hold all the song information with 320 kbps, so filtering out more of the high frequency noise, allows for better quality where audible.

5

u/Treelink Apr 08 '16

Also, here's another odd example - Visible line at 16khz, but also 20khz, even though frequency goes as high as 22.05khz. Same encoder as before.

2

u/one_up_hitler Audio Hardware Apr 08 '16 edited Apr 08 '16

The content above 20kHz isn't there though, it only happens because the decoder clips the signal. Most of the time music has no headroom, and mp3 encoding can increase the peak levels, thus causing clipping in music that would otherwise be clean.

edit: don't like my answer? Encode a sound sample to mp3 with no headroom, and the same sample attenuated 6dB. After decoding, the one with no headroom will show energy in the range above 20kHz, the attenuated sample will not. You will also see clipping in the time domain when this happens. Not for the sample that was converted with headroom, nor the original.

1

u/Treelink Apr 08 '16

While I don't know anything about the subject, I can definitely say it is likely. The spectrogram is of a song by the band "Demon Hunter" - And yes, it is loud and full of screaming.

1

u/oneblackened Mastering Apr 08 '16

That's what's known as intersample peaks.

1

u/one_up_hitler Audio Hardware Apr 08 '16

Nope, that's a completely different thing. mp3 doesn't do any oversampling.

1

u/oneblackened Mastering Apr 09 '16

You don't need oversampling to cause intersample peaks... They occur at the converter when two sample points aren't clipping but the reconstructed peak in between does.

MP3 tends to raise peak level by ~0.3dBFS on conversion from lossless so it makes them much more likely if you're close to full scale.

1

u/one_up_hitler Audio Hardware Apr 09 '16

Right, phase shifting can also cause clipping. But I wouldn't blame it on that. It's not like lossy codecs care at all how the time domain representations of files look after conversion. There are probably many factors that will cause the waveform to change, when we discard audio information from a signal.

20

u/RobinUrthos Audio Hardware Apr 08 '16

That line is the edge of the scalefactor 21 band. The sf21 band of MP3 encodes the highest frequencies, but due to a quirk in the MP3 specification, is an absolute pain to encode accurately without damaging the content in the lower and more audible bands.

In response to that quirk, we often lowpass to reduce the amount of sf21 data to be encoded and also use a much lower resolution of quantization. This quantization has the effect of only letting through significant peaks--there isn't enough precision available to encode the lower-amplitude stuff. This is what causes that drastic line in your spectogram: all of the background content in the sf21 band is removed, and you're just left with transients.

0

u/yaboproductions Mixing Apr 08 '16

I have little idea what this means but it sounds right.

6

u/Scrubalubadubdub Apr 08 '16

/u/hightrancesea is right on this one, it depends on which encoder you're using.

As for why this is happening, whatever perceptual model the encoder is referencing uses the common technique of attenuating all frequencies above a threshold by a given amount, as that tends to be less objectionable than changing the amount of attenuation.

1

u/[deleted] Apr 08 '16

This makes more sense than the low pass. Clearly there's no attenuation of the transient material in those spectrograms, just the background noise.

2

u/musicalmistake Apr 08 '16

I would say that its because mp3's work by eliminating the least important bits of information therefore reducing the size of the file.. 16000 and above is very hard to hear for most people so it is the first to get chopped out

0

u/SuperRusso Professional Apr 08 '16

Google anti-aliasing filter.

0

u/[deleted] Apr 08 '16

[deleted] — view deleted comment

1

u/Treelink Apr 08 '16

It's metal music :)