## Topic: SNR of MP3 (Read 18819 times)previous topic - next topic

0 Members and 1 Guest are viewing this topic.
• Neuron
SNR of MP3
##### Reply #50 – 30 December, 2012, 04:43:03 PM
No, MP3 doesn't store wave data in PCM format.

That is my point. So it does not follow at all that the "bit resolution" of mp3 is only 2.9 bits.

• lvqcl
• Developer
SNR of MP3
##### Reply #51 – 30 December, 2012, 04:54:14 PM
True, but if the SNR of an mp3 file is 18dB then one can say that this is 18/6.02 = ~3 bits.

• Neuron
SNR of MP3
##### Reply #52 – 30 December, 2012, 05:08:55 PM
Bit depth is not a measure of signal to noise ratio. It measures the amount of bits per sample and the number of steps it is therefore divided into. Even a signal that is just 18 dB above white noise will sound much better than a sound wave trunicated into just 7 possible steps. Would a signal that is just 18 dB above a constant sound of horse farts be "3-bit"?

Bit rate reduction produces a very specific form of audible degradation and one that is far from either hiss or mp3 artifacts. It is the result of making the waveform "blockier".

Saying a random signal with a SNR of 18 dB is 3-bit is like saying a camera image covered with vaseline has a resolution of 320x240. It is apples vs. oranges. People should stop trying to put non-PCM things in PCM terms. I can "record" a sine wave 30 seconds long, 200 Hz frequency by just writing "play sine wave 30 seconds, 200 Hz" with theoretically no noise in just a few tens of bytes. Does that mean the sine wave has in fact a "bit depth" of only say 0.0000001 bits and a SNR of 0.00006 dB despite being described perfectly? I do not think so.

• saratoga
SNR of MP3
##### Reply #53 – 30 December, 2012, 06:26:47 PM
Bit depth is not a measure of signal to noise ratio.

No it basically is in so far as the amount of information determines the maximum SNR.

It measures the amount of bits per sample and the number of steps it is therefore divided into.

For PCM audio this is correct, but MP3 is not PCM.  MP3 is a lossy transform codec.  It has nothing analogous to PCM's quantizer step sizes, so anything you assume about it involving quantization steps will not be correct.

• Neuron
SNR of MP3
##### Reply #54 – 30 December, 2012, 06:39:39 PM
What does "noise" mean in the case of mp3s anyways? How would that noise sound if it wasn't masked? What does a 2.9 bit depth even mean for mp3? How does a codec with ~30 dB signal to noise ratio have a dynamic range of ~150 dB? Honest questions, lossy compression is really starting to confuse me  .

And what is the effective SNR of mp3? As in, does an average mp3 sound like a linear PCM file with a SNR of 96? 90? 80? 75? 70?

If mp3 has a signal to noise ratio of only 15-30 dB, how come it is close to the original sound not only when listening but also when looking at it in an audio editor? How come the waveforms are similiar to the original and don't look or sound noisy at all? If it was all psychoacoustic tricks and the waveform was in reality a noisy, 2.9 bit mess, it would show up in an audio editor. Yet there are no obvious faults except for a lowpass for the highest frequencies.

SNR of MP3
##### Reply #55 – 30 December, 2012, 06:46:51 PM
Bit depth is not a measure of signal to noise ratio.

No it basically is in so far as the amount of information determines the maximum SNR.

It measures the amount of bits per sample and the number of steps it is therefore divided into.

For PCM audio this is correct, but MP3 is not PCM.  MP3 is a lossy transform codec.  It has nothing analogous to PCM's quantizer step sizes, so anything you assume about it involving quantization steps will not be correct.

Its has SOME relation to PCM  as its final destination is a PCM DAC whether in my car, PC or some other player.

GĀ²

• saratoga
SNR of MP3
##### Reply #56 – 30 December, 2012, 06:49:03 PM
What does "noise" mean in the case of mp3s anyways?

See Woodinville's post above.

How would that noise sound if it wasn't masked?

Masking is the process of making something in audible.  Masked noise is therefore inaudible.

What does a 2.9 bit depth even mean for mp3?

(128000 bits/second) / (44100 samples/second) = 2.9 bits per sample.  Thats all it means.

How does a codec with ~30 dB signal to noise ratio have a dynamic range of ~150 dB? Honest questions, lossy compression is really starting to confuse me  .

Dynamic range has nothing to do with SNR.  The former is just the ratio of the largest magnitude to the smallest, while SNR is the ratio of the maximum signal value to the noise power.

• saratoga
SNR of MP3
##### Reply #57 – 30 December, 2012, 07:00:22 PM
And what is the effective SNR of mp3? As in, does an average mp3 sound like a linear PCM file with a SNR of 96? 90? 80? 75? 70?

'Effective SNR' is kind of meaningless in this context, but I would say that since MP3 files are generally transparent, and 16 bit PCM is generally transparent, 16 bit PCM is a good format to use with decoded mp3 audio.

If mp3 has a signal to noise ratio of only 15-30 dB, how come it is close to the original sound not only when listening but also when looking at it in an audio editor?

This is because the dB scale is logarithmic, so a 30 dB SNR will result in an error that is on average just 1/31.623 of the signal, which is quite small by eye.

• Neuron
SNR of MP3
##### Reply #58 – 30 December, 2012, 07:04:59 PM
What does "noise" mean in the case of mp3s anyways?

See Woodinville's post above.

How would that noise sound if it wasn't masked?

Masking is the process of making something in audible.  Masked noise is therefore inaudible.

What does a 2.9 bit depth even mean for mp3?

(128000 bits/second) / (44100 samples/second) = 2.9 bits per sample.  Thats all it means.

How does a codec with ~30 dB signal to noise ratio have a dynamic range of ~150 dB? Honest questions, lossy compression is really starting to confuse me  .

Dynamic range has nothing to do with SNR.  The former is just the ratio of the largest magnitude to the smallest, while SNR is the ratio of the maximum signal value to the noise power.

So the 2.9 bit/sample figure for mp3 does not represent resolution, just mathematics? And how would mp3 noise sound if it was unmasked?

• saratoga
SNR of MP3
##### Reply #59 – 30 December, 2012, 07:21:35 PM
So the 2.9 bit/sample figure for mp3 does not represent resolution, just mathematics?

What does resolution even mean in this context?

Maybe now would be a good idea to read up some more on PCM, particularly how SNR is calculated.

And how would mp3 noise sound if it was unmasked?

Subtract off the signal and listen for yourself.

• Neuron
SNR of MP3
##### Reply #60 – 30 December, 2012, 07:25:16 PM
So the 2.9 bit/sample figure for mp3 does not represent resolution, just mathematics?

What does resolution even mean in this context?

Maybe now would be a good idea to read up some more on PCM, particularly how SNR is calculated.

And how would mp3 noise sound if it was unmasked?

Subtract off the signal and listen for yourself.

Thanks, but I don't know how to subtract the signal. And I know the PCM SNR formula is roughly 6.02*number of bits. However a 3 or 5 bit PCM file looks and sounds atrocious while the supposedly 2.9 bit mp3 sounds and looks very close to the original.

• Neuron
SNR of MP3
##### Reply #61 – 30 December, 2012, 07:38:08 PM
And what is the effective SNR of mp3? As in, does an average mp3 sound like a linear PCM file with a SNR of 96? 90? 80? 75? 70?

'Effective SNR' is kind of meaningless in this context, but I would say that since MP3 files are generally transparent, and 16 bit PCM is generally transparent, 16 bit PCM is a good format to use with decoded mp3 audio.

If mp3 has a signal to noise ratio of only 15-30 dB, how come it is close to the original sound not only when listening but also when looking at it in an audio editor?

This is because the dB scale is logarithmic, so a 30 dB SNR will result in an error that is on average just 1/31.623 of the signal, which is quite small by eye.

Thanks for clarifying this more, but about the SNR, how come 5-bit PCM (~30 dB SNR) files are so obviously blocky then? And I don't mean at some low sample rate but 44.1 Khz.
See picture of a file bitcrushed to 5-bit in Audacity:
http://i46.tinypic.com/2ro27uw.png
http://i46.tinypic.com/142wm04.png

A 3-bit (18 dB SNR) example looks like it was run over by a steamroller and then set on fire (and it sounds as horrible as it looks):
http://i48.tinypic.com/1zfzex.png
http://i45.tinypic.com/30kd2cg.png

• greynol
• Global Moderator
SNR of MP3
##### Reply #62 – 30 December, 2012, 07:43:05 PM
Wow, we've gotten deep in the rough on this one.

There are plenty of nice descriptions about how mp3 works on this forum. For the love of all that is sacred, please look up one of them.
Is 24-bit/192kHz good enough for your lo-fi vinyl, or do you need 32/384?

• saratoga
SNR of MP3
##### Reply #63 – 30 December, 2012, 07:45:26 PM
And I know the PCM SNR formula is roughly 6.02*number of bits.

Yes, and my suggestion is that you read up on how that number is calculated.

Thanks for clarifying this more, but about the SNR, how come 5-bit PCM (~30 dB SNR) files are so obviously blocky then?

Because your audio editor isn't plotting it right. Again, now is a REALLY good time for you to read up on how PCM works.  You're not going to get anywhere with compressed audio without first understanding more about how uncompressed audio.

• Woodinville
SNR of MP3
##### Reply #64 – 30 December, 2012, 09:45:34 PM
Yes, but MP3 is not 5 or 6 bit PCM. It is a 32 bit floating point file that contains lossily compressed information which is stored in a non-PCM way.

-----
J. D. (jj) Johnston

• Woodinville
SNR of MP3
##### Reply #65 – 30 December, 2012, 09:49:20 PM
So the 2.9 bit/sample figure for mp3 does not represent resolution, just mathematics?

It is mathematics, bit depth resolution in the frequency domain, required by the shannon theorem, and is what it is, period.  Don't try
Quote
And how would mp3 noise sound if it was unmasked?

http://www.mp3-tech.org/programmer/docs/CaveT2002.pdf

Try it and find out.
-----
J. D. (jj) Johnston

SNR of MP3
##### Reply #66 – 31 December, 2012, 10:17:56 AM
I don't get it. If I encode 1 kHz at 0 dB to mp3, will that mean I will get noise at -30 dB?

Amount of mp3 noise depends on mp3 bitrate and signal complexity. Generally, tonal material is easier to compress and it results in less noise. If you take a mono file with 1-kHz tone, mp3 noise will only be around ā60 dB (for bitrates between 64 and 160 kbps). But if you take more complex recording, your noise will be higher.

SNR of MP3
##### Reply #67 – 31 December, 2012, 10:19:05 AM
Also note that the noise from 1-kHz tone will mostly be concentrated at frequencies adjacent to the tone, where it's easiest to mask.

• pdq
SNR of MP3
##### Reply #68 – 31 December, 2012, 10:36:36 AM
Also note that the noise from 1-kHz tone will mostly be concentrated at frequencies adjacent to the tone, where it's easiest to mask.

Is that really true? I would have thought that inaccuracies in a 1-kHz tone after lossy compression would have been distributed over a wide range of frequencies, especially overtones.

SNR of MP3
##### Reply #69 – 31 December, 2012, 10:43:22 AM
Not at all. Since mp3 is a subband coder, a single tone occupies only 1 or 2 frequency bands. And all the quantization noise is concentrated in these 1ā2 bands. There is also a small amount of inter-channel leakage in the filter bank, but it is on the order of ā90 dB or even less.

• pdq
SNR of MP3
##### Reply #70 – 31 December, 2012, 11:11:48 AM
OK then, what kind of noise are we talking about that would be adjacent to the tone? Phase noise?

SNR of MP3
##### Reply #71 – 31 December, 2012, 01:02:44 PM
Yes, but not only that. Here is the picture. White is your 1 kHz tone, blue is the noise that mp3 encoder adds at 128 kbps.

• greynol
• Global Moderator
SNR of MP3
##### Reply #72 – 31 December, 2012, 02:35:13 PM
What is the bit-depth of your source signal used to create that graph and does increasing it change the result?

What if you change the frequency so that it lands perfectly in the middle of one of the MP3's FFT bins?

Does the side-band noise change depending on which bin is being used (by changing the frequency)?
Is 24-bit/192kHz good enough for your lo-fi vinyl, or do you need 32/384?

• pdq
SNR of MP3
##### Reply #73 – 31 December, 2012, 02:43:03 PM
Looking at the white plot, I would guess that the original tone had significantly better than 16 bit resolution.

Edit: What if the frequency is right on the border between two FFT bins?

Edit2: What would happen if you bypassed the encoder with its limitations, and simply generated an mp3 to produce a 1-kHz (or any other frequency) tone?

SNR of MP3
##### Reply #74 – 31 December, 2012, 03:11:25 PM
I've used a 32-bit float source and 32-bit float decoding. The sideband products are most likely the filter bank leakage. If you attenuate the tone, they fade too.

Here's how it looks when the signal is aligned with MDCT bins (I hope I did my math correctly by setting f = 1225 Hz).