Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to objectively measure the quality difference between two audio files -- through a "scientific" measurement, and not using one's ears or opinion?

I have two files -- one encoded at 768kb/s, and the other at 1536kb/s. I'm wondering if there's a way to determine how much higher quality one is over the other. Is it perhaps possible to open them up in a type of audio analysis program and check for clipping, resolution, etc.?

share|improve this question
Based off of the two answers below, I think we basically have 1) Absolute best "technical" quality, and the subject best quality... with @slhck answer, I think we can confirm there is no scientific way to know for sure which one would be liked better... But I think we can tell which one should be of higher technical quality based off my answer... I sort of think they are both right for different interpretations of your question, so maybe some more guidance from you now is good. – AthomSfere Apr 1 '13 at 0:11
"I have two files -- one encoded at 768kb/s, and the other at 1536kb/s..." -- Those are just data rates. They could be for completely different recordings, i.e different songs. The codecs could be different. The sample rates could be different. The sample sizes (aka bit depth) could be different. But if all of those parameters were the same, then the difference in data rates would probably indicate different levels (aka Q) of lossy compression. – sawdust Apr 1 '13 at 7:21
You can run the sound through an FFT and analyze the resulting frequency spectrum for various things. Low frequency cutoff, certainly, and probably clipping. From the "slant" of the spectrum you can roughly guess if the sound is "muddy". Really a question for the Signal Processing SO site, though. – Daniel R Hicks Apr 1 '13 at 16:13
up vote 9 down vote accepted

Can you objectively tell the quality?

Generally, no, there's no accurate way to objectively measure audio quality with enough precision. Simply said: Without asking a set of people for their specific rating, you can never quantify "how much higher" in quality one piece of audio is, compared to another. Quality itself is never absolute—it's highly subjective.

What researchers usually do to alleviate that problem is the following: They define a scale according to which they let a set of people rate the quality, such as a five point one (Bad, Poor, Fair, Good, Excellent). Or you could simply compare certain codecs (but that wouldn't give you very meaningful data). Researchers then use these ratings to model a computer metric that tries to predict the human response.

Objective quality metrics

A rather old but popular objective audio quality metric is Perceptual Evaluation of Audio Quality (PEAQ), described in ITU-R BS.1387 (1998). Basically, it tries to emulate the human ear and generate opinion scores from 1–5, like a human listener would do. PEMO-Q from 2006 is a more recent metric that claims to outperform PEAQ.

These metrics are often tested on single sounds or speech, and not necessarily on music, as it is much harder to estimate the perceived quality from complex sounds, where masking effects are much more prevalent. This metric from 2008 is targeted more towards music.

It seems to me that research in audio quality metrics is not as active as for video quality metrics (a topic I'm working on). You will have a hard time finding a standalone tool that you can use on Windows where you can just plug in two sources of audio and get a result. Most metrics are developed internally at research institutes and rarely see the light of the public. Or they're commercial tools for broadcasters and telecommunications providers.

Here's a MATLAB implementation of PEAQ, but that's all I know of from the top of my head.

What you can do when comparing files

Looking at the problem from a technical perspective, it is important to mention that you can – in theory – guess which file delivers the better quality by just looking at the data rate. This, however, only works reliably when the files contain the same source content, and they were encoded with the same encoder.

That's the whole idea behind the codec listening tests: You take the same source, encode it to different data rates (or quality levels) with different encoders, and then have users compare them. With this "ground truth" data, you could for example say that an MP3 file encoded with LAME at 128 kBit/s sounds equally good as an AAC file encoded with FAAC at 64 kBit/s (these are made up numbers, but you get the idea).

It's even easier if you know that the same encoder was used for both files, because then chances are very good the data rate (file size) is enough to make an educated guess about the resulting quality.

But then again, this only works when the sources are the same. Some codecs perform better for different kinds of music or speech. Some work better at lower bit rates and don't necessarily provide any better quality at higher rates. There are just too many factors to consider.

share|improve this answer

The best measures are format, and sample rate. Although file size may give you some idea.

In fact, we need to recognize that the difference in quality of the recording might not mean that it will sound best to the ear, it will simply be a better fidelity to the original recording.

Format - MP3 is not going to have the same quality as a lossless format such as FLAC, and depending on other factors in the codec two lossy formats can have different results based off of compression and how compression is done

Sample Rate is going to determine how often information is taken from the recording and then played back per second, obviously 1Hz would be horrible quality, where as 24kHz would sound good. Higher is better.

Bit Depth This is similar to a processor, where for each sample you can record x bits per sample. More bits means more information which means a better quality recording.

File Size IS the result of the quality of the recording. Where Sample Rate, Bit Depth, Channels and compression are the ingredients for the file size. You can calculate examples yourself to see it.

My disclaimer here, is that this might not matter for some recordings. If you are listening to a recording from the 40's, its going to be a poor recording no matter what. You can't add information the original format did not contain to a new recording by increasing any of the above.

share|improve this answer
"You can't add information to a recording by increasing any of the above." -- That's a misleading and poorly-worded statement since nobody established what the reference recording is. If you start with a highly compressed, 8K/sec sample rate and 8-bit samples (e.g. business-grade voice), then your assertion falls apart. – sawdust Apr 1 '13 at 7:29
@sawdust I think you knew what I meant from context, but I tried to clear it up too. Thanks – AthomSfere Apr 1 '13 at 11:46

You could open them up in an audio editing program, and zoom down to the individual (digital) waves , and cross compare pixels against some original. enter image description here

Using this program I often see stairstepping, and clipping easily, that is usually from a very poor rate or very poor quality of encodings, or both.

To get any deeper when your talking very high rates, it would have to be comparing a section of it, visually. Having sounds that are supposed to be similar, there is differencing methods, to remove one sound clip with another sound clip, what is left is the changes between them. In there one of the noise filters could do that easily, there are other methods I am sure, like negative mixing, where a perfect clone of the sound would zero out the visual line.

I think inverting the "phase" and doing an additive mix accomplishes that also. The end result of a perfect clone reverse mixed with the original, should be a totally flat line, and no sound output when played. It is easy enough to test the theory, and work out a plan, use the exact same sound clip first, then try the same thing with the compressed clip instead.

Think of it like this, in a photo program you could load in a Jpeg compressed version of the exact same picture you are working on, do a differencing overlay. Align the clip to the original, and all the artifacts and blocks and color changes show up instantally as colors and levels of colors, everything that is 100% the same as the original is pure black. With an audio editor you could do the same thing for audio.

share|improve this answer

If you don't have lossless original in any form that you can compare quality of two lossy-coded pieces of music by your ears.

share|improve this answer
The OP explicitly said that they don't want to use their ears though. – slhck Apr 1 '13 at 10:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .