Help - Search - Members - Calendar
Full Version: Playing Back The Difference Between Compressed & Uncompressed
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - General
Snash
Is there a tool that would compare a compressed audio file and an uncompressed audio file and create a new file that contains only information that existed on the uncompressed and is not present on the compressed version?

Original - Compressed = Newfile

If it is possible, I realize it would sound like garbage or hiss or perhaps inaudible, but it would be interesting to "hear".

I got to thinking about this when reading about joint stereo and how information from the channels is added and subtracted from each other.
MLXXX
Snash, to experiment you could do the following:
  • Download "Audacity" (free, audio editing software)
  • Import the uncompressed and compressed files into Audacity
  • If the files ae not already time aligned, drag one file so that it time aligns with the other [this requires expanding the view horizontally; it can be quite hard to do as the compression can make the waveforms look very different as between the files; in some cases the precise alignment may best be finalized by ear]
  • Use the invert effect on one of the files
  • Hit play, to play back the two files simultaneously [the inverted file will subtract from the non-inverted file]

Once satisfied you have correct time alignment, and an optimal* level alignment, you can save the result.

The result is usually an audible file that is recognizable as the original piece of music, though it may be thin, and include "wooshing" sounds.

*One issue you may find is that the volume levels vary between the files from time to time, making it impossible to get a good "null" throughout the playback. The Audigy effect "amplify" can identify peak volume but compression codecs often alter the peak volume relative to the average volume. It may be possible to improve the null by trial and error, by varying the volume slider of one of the files during playback.

[JAZ]
Snash, two comments on your question:


First:

MLXXX's reply is what one would try to do, if wanted to hear the difference signal between two audio samples. This difference can be anything, but like he said, with lossy encodings it generally is quite audible.

But.... It is in no way a good method to find what has been removed (i.e. what is not kept) in a lossy file.
There is no good method to get such information, because to get the differences, a program should be very precise in the frequency domain and generate the difference from there, not in the time domain.



Last:

I'm especially puzzled that Joint stereo is what made you thought about the differences. If you mean that reading about Mid and Side channels made you thought about finding the "Side" channel between a compressed and uncompressed signal, then it's alright.
If, on the other hand, you thought "joint stereo joins the signal so there is a loss", then i have to correct you and remark the mathematical side of such a method.
DVDdoug
Snash,

You are not the first person to think of subtracting to find-out what's lost with lossy compression, but alas, it doesn't work. wink.gif Yes, you can find (and hear) the mathematical difference, but this is not the audio difference or the data that was "thrown-away"

QUOTE
I got to thinking about this when reading about joint stereo and how information from the channels is added and subtracted from each other.
FYI - The sum & difference files are created before applying the lossy compression.

With lossy compression, the precise timing & phase are not preserved.

As [JAZ] suggested, uncompressed audio is stored/represented the time domain. For example, at 44.1kHz, you have one sample (one "sample point") 44,100 times per second. (See the Audacity Introduction To Digital Audio.) Once you understand how digital audio is sampled, it's easy to see how a very small time-shift can throw-off any addition or subtraction. It doesn't take much time-shift to introduce enough phase-shift that you end-up "subtracting a negative number", which of course results in addition!

In fact, by time-shifting a waveform and adding it to (or subtracting from) the original, you create a comb filter. If you listen to the original and time-delayed file, they sound identical (because the actual audio is identical), but when you subtract the two files, something "funny" happens! (This is not exactly the same thing that happens with lossy compression... You do not get a comb filter when you subtract the compressed & uncompressed files... It's just shows the kind of things that can happen with time/phase shifts.)

Another example... If you invert the phase of a file it will sound identical to the original. But then if you subtract it from the original, you are "subtracting a negative" and you will double signal level, and perhaps get clipping (distortion). What you are hearing is the mathematical difference (assuming no clipping), which doesn't tell you anything about the audio difference.

You can actually play around with M/S coding using Audacity (or other audio editor)... You can open a WAV or MP3 file, create the sum & difference channels, save that file,, then re-open it and add & subtract again to re-create the left & right channels. (If you're comfortable with algebra, you should be able to figure-out the details.)

There is one thing... When you add and subtract (mix*) the left & right, you need to divide by 2. This is because some samples will already be at, or near, 0dBFS (the digital maximum) and you can get clipping after mixing. Then, when you re-construct the left & right channels, you'll need to multiply by two to restore the original signal levels

You can also try subtracting a file from an exact copy of itself... You will get absolute silence! And, you can try time-shifting before adding/subtracting to create a comb filter.



* Audio editors don't usually have "add" or "subtract" functions, but mixing is done with addition. So, if you want to add two files, you use the mix feature/function. If you want to subtract, you invert the phase of one file before mixing.

Snash
MLXXX & DVDdoug - Thanks for the info, I'll give it a try, I had expected that the high frequency would be cut off but not much else, time alignment, phase shifting and inaudible chnages could really impact the results

[JAZ] - The former. I was fascinated by the methodology of how they created joint stereo, and the step of subtracting one signal from the other. I realize that joint stereo in and of itself does not create a loss.

I'm going to give it a try using Audacity and see what happens.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.