Home
Sound
Car Audio
Cabling
Amplifiers
Valves
Speakers
CD Players
Recording
Surround Sound
Radio Tuners
Vinyl Records
Guitars
Drums
Microphones
Mixing
Computers
Synthesisers
Tape Recorders
Headphones
Transformers
Other

MP3 distortion



I went back to my old files and looked at teh distortion of
MP3 and WMA.

I simply ripped CD files to hard disk .wav files, encoded
them using various encoders, then decoded them back to new
.wav files. Now there is a problem with just comparing these
pairs of original/decoded wav files: the decoded ones are
longer, and don't line up with the originals. So the next
step is to calculate the cross-correlation function of the
original and decoded files for a few seconds of them. This
tells us the offset exactly. I then line them up and
subtract the original from the decoded one, producing a
difference file. Next, I remove the DC component that
appears in the difference one (which can be non-zero).
Finally I plot the power in both the original and the
difference file for one-second intervals over the whole
files, along with the power ratio (in dB). The power ratio
of course is just the RMS distortion in the difference one,
assuming that are properly normalized (it appears all teh
normal .mp3 or .wma encoders do not play with the levels
Ermm.. I think there may be an obvious hole in your method.
Noe, it is valid. There is one obvious hole in what I actually
described, which is that it does not account for a steep
low-pass filter in the encoder .. which would of course
render it wrong. However, A careful check shows that in
the results I mentioned, there is no such filter. Some WMA
results and certain other MP3 encoders show signs of such a
thing ... in those cases, you must apply a filter to the
'original and difference before comparing them, lower cutoff
than the one in the encoder.

Other than that, THIS METHOD IS DEFINITIVE.


A great deal of the research that goes into encoding audio is in finding
ways that distortions can be masked by the various sounds. If you take
Distortion is distortion: if there is no distortion, then
the streams will sound alike, which is the goal.

away the sounds, then I can not see how you would be testing the
encoders ability to mask the distortions.

unless told to.)

Except for occasional spikes, mp3 at 128k produces about
5 to 10% distortion. MP3 at 192 produces 2 to 3% distortion.
WMA at 96 seems about equal to MP3 at 128. These
are very preliminary figures on omly a few CDs; I will do
more and more accurate ones later.
Well I Don't think 128k is really enough for MP3.
At 192k using a recent LAME encoder it sounds a lot better.
Although VBR is he best option (as long as you are using it for an
application that can use VBR).
It's hardly a shocking result that as bit rates fall, distortion increases
and audio quality decreases. But Doug's methodology doesn't include a
psychoacoustic model, so it doesn't show how perceptible the distortion is,
which is obviously the crucial thing here, because perceptual audio codecs
are designed specifically to discard inaudible information, which is bound
to distort the signal.

The objectivity in perceptual audio codecs comes from blind listening test
results (excluding results made by people that have a vested interest, such
as the DAB industry).


There are differences in encoders for MP3. The best I
actually have is a very old BladeEnc that is a command line
utility. I have only one WMA encoder, Microsoft's.
If as you say your encoder is very old, then that would be another hole
in your methods.

Encoders have improved a lot over the past few years. So where is the
logic in testing an old one when much better encoders are available today.

Why don't you try the latest LAME encoder for MP3, you should be able to

You can use it from the command line if you prefer, or you can download
a GUI front end, such as
is quite easy to use.

I'm currently using version 3.97 of the LAME encoder. This was the most
recent stable version, last time I checked (a few weeks ago), but there
might be a slightly newer version by now.

LAME is very good these days, although I still don't think 128k is enough.


The bottom line is that 10% distortion is bad. On really
difficult parts, such as the very loudest parts of certain
classical pieces, I have seen as high as 40% distortion
at 128k, even with the best encoder I have.
Do I have to teach you about psychoacoustic compression _again_?
No, **I** am teaching YOU about DISTORTION. DISTORTION IS
Doug, your field of expertise is chemistry, whereas David has a PhD in the
field of pyschoacoustic compression.

Please stop being a silly billy.
I've already been trying to explain things to him in another sub thread.
If he doesn't get it soon then I'll probably give up.

Doug, if you can not actually *hear* the distortion then it's presence
is *irrelevant*.

Richard E.

DISTORTION, and
we should avoid it like the plague. Do read my last post about
If you believe that as strictly and blindly as you seem to, don't use
psychoacoustic based coding.

Simple.

Now, move on people. Nothing to see here.

Cheers,
David.

the validity of the idea of noise shaping the errors,
however. This is the LIMIT of the validity of "psychoacustic
encoding". It is inapplicable to much music.

You are an apologist for bad sound if you believe in other
than an extremely limited validity of "psycoacoustic
encoding". In other words, you may have been brainwashed.

Doug McDonald


Rather than repeating the thread (which you are doing!) can't you just
refer to groups?

Cheers,
David.
That would be bad. But it is probably that bad because your have an old
encoder.

A few years ago I encoded some music at 128k. At the time I used an
encoder built into a program called NexEncode. I listened to it at work
for a few months through the PC speaker. Then I started to listen
through headphones and it was not very long before I started to notice
artifacts. This was probably similar to the distortion you are finding.

A few days ago I thought I'd see if a recent LAME encoder could encode
the same music at the same bit rate without producing the artifacts. And
guess what it could. Playing it back I could not hear any of the
artifacts that were present in the version I encoded a few years ago.
Basically MP3 encoders have improved. The only problem I have with 128k
these days is that it is a bit too lacking in clarity.


And when listened to, which of course is possible using this
test method, the difference files typically sound horrible.
Of course it would sound horrible. The encoders rely on the presence of
the sound, to mask the distortions. Part of a good encoder is it's
ability to mask the distortions. If you take away the sound, you take
away all the masking. So you are not testing the capabilities of the
encoder to mask the distortions. So what is the point of doing that??
Distortion is distortion.
Sorry, but no that is not the case for perceptual encoding.

Only audible distortion is relevant. Inaudible distortion is irrelevant.
If you are worried about distortions that you can not actually hear,
then you must be using the encoder in some way that it was not intended
for. For the intended use, ie. listening to the sound that has been
encoded, all that matters is what you are able to hear. If you can not
hear the distortion, then I'm sorry, but that distortion is irrelevant.

That is a mayor principle of perceptual audio codecs, and masses of
research have gone into improving these techniques. If you ignore this,
then you are not proving anything useful.

The 192 results for MP3 sound very much like very mildly
noise shaped random noise, with just a tinge of the original
program ... even at very high gain. Just listening to the
difference signal and taking into account the distortion
figure ... I would have expected 192 encoded material to
sound great. And to my ears it does.
I've used 192k on my car stereo, and never noticed any problems. I never
bothered to try it out on my hifi though, so I couldn't say whether it
is as good as real CD quality.

Suggest one! I tried several free ones, and while some did a
teensy bit better than the old Blade, MOST of the time, all
suffered from occasional "blats" of horrendous distortion
at places where the music suddenly got very loud. Some had
distortions of well over 100%, and sounded that bad.
LAME as recommended below.

However if you are taking away the masking of the distortions, then you
are not really testing the quality of the encoder.

I'll try that one. The LAME I tried had a very agressive low
pass filter, and as I said, my current programs can't take
filters, since the result will just be the program material
over the cutoff, which is not actually "distortion", well,
it is, but it isn't to me since I'm 61 years old.
I think it is possible to switch off the low pass filter. I just took a
look through the long help (by typing LAME --longhelp) and it says that
the parameter -k means "keep ALL frequencies (disables all filters),".

So unless they have disabled this parameter, you should be able to
switch off the low pass filter.

I'm not claiming 128 is enough ... I'm claiming that 10% is bad.
If 10% distortion was audible during normal playback, they that would be
very bad.

However as I tried to explain above, a major part of the encoder is it's
ability to mask these distortions. This should make the bulk of this
distortion inaudible. Hence if MP3 is used the way it was intended to be
used, any inaudible distortion is irrelevant. If you delete the audio,
you delete the masking, and so you are not testing the encoders ability
to do what it is intended to do.

Because I simply do not believe in the whole idea of
"masking" except for the limited idea of noise shaping the
errors. This of course can reduce the "perceived" problem if
you encode a flute, which is near a sine wave: if you keep
the distortion spectrum well away from the region where the
flute itself has no power (like the bass and high treble),
teh result is better than if you had broad band noisy
distortion. BUT, BUT ... I test with wide band orchetral
classical music, which has NO GAPS in the frequency spectrum
... an encoder has no choice about where to put noise. It
HAS to put it everywhere except maybe the very low bass.

Doug McDonald
Well if you don't believe in masking distortion, then you don't believe
in one of the most important principles of perceptual encoding. If you
can not actually detect the distortion, with your ears, while playing
back the file as intended, then the actual presence of the distortion is
irrelevant.
NO, as I said before, what **I** (and you said "you", which
is ME) hear is not all that important as a definitive test,
since I'm 61 years old. You need young people, AUDIOPHILES,
Well that depends upon whether you are encoding sounds for your own use,
of for broadcasting the other people.

I never actually meant to imply that what specifically you or I can hear
is necessarily what is important. I meant that after years of research
there is a very good level of knowledge of the abilities of human
hearing, and this no doubt includes knowledge of the way hearing
abilities change between different people for reasons such as age.

who have never been exposed to overly loud sound levels.
And I'm sure that the researchers have studied the hearing abilities of
young people and of audiophiles.

Richard E.


Doug McDonald

P.S. yes, I was a violist ... but I wore ear plugs during
pieces that had loud trumpet passages!
That sounds like the opening bars of a viola joke. What's the payoff?
Unfortunately, or fortunately, there isn't one. I retired
after college to become a scientist. I'm a far better
scientist than violist.

Doug McDonald


Richard E.


Richard E.

At best (WMA with adequate bits) it sounds like white noise.
At worst, well you know what that sounds like, since it is
clearly audible over the encoded music!

Doug McDonald