Ok, this losless compression confusion is annoying me
Apr 13, 2006 at 11:43 PM Thread Starter Post #1 of 15

Sycraft

100+ Head-Fier
Joined
Jul 6, 2004
Posts
440
Likes
12
So some people seem to be confused in to thinking that FLAC, or ALAC alter the sound of files, like MP3 does. That's just not the case. Lossless compression is just that, lossless. All information that was present in the original is present in the compressed version. When it's decompressed, the reconstruction is bit-identical.

The upshot of this is that, barring you having a broken encoder or decoder, FLAC will sound precisely the same as WAV, and one lossless compression will sound the same as another. Don't believe me? Here's a test:

I took a short audio file that I recorded for a presentation and dumped it to WAV on my computer, it was called orignal.wav. I encoded that to FLAC, then decoded the FLAC to WAV, using the FLAC encoder from flac.sourceforge.net. I ran a diff on those two files, which will note any byte that is different. Here's the result:

diff.png


As you can see, the two files are bit-identicle, right down to the headers. As another test, I loaded both files in to Wavelab, I took the orignal, inverted the phase, and added it to the FLAC'd version. The result?

difference.png


Digital silence. The files were identical, so they canceled each other out.

If you want you can get the difference WAV and listen yourself, but you won't hear anything except noise your soundcard makes.

If you want to test yourself you can look at:

http://sycraft.org/flac/a.wav
http://sycraft.org/flac/b.wav
http://sycraft.org/flac/c.wav

One of those is the original WAV, two are the de-FLAC'd versions. You can listen and see if you can tell the difference. You can't, they are bit identical, but if you want to waste your time trying, be my guest and post your guesses.

I would have tested ALAC as well, but unfortunately, Apple gives no way to route decoding to disk. Doesn't matter, unless they broke their decoder, the results would be the same.

The moral of the story is that lossless encoding is just that: Lossless. It's not like MP3 where it's using perceptual data to try and reconstruct something, it's a mathematical reduction of data that is exact. The same thing, to the very bit, is sent to the soundcard.

If you believe you hear a difference you are either fooling yourself, or you don't have your player configured right. For example, you might enable something like Realplay gain for FLAC files, which tries to normalize audio levels. That would change the sound of it for sure, because it changes the volume. However that's post processing, not a property of the FLAC encoding itself.

You can use FLAC with confidence that it reproduces your original data completely accurately. It's just up to you to configure your player to leave that unmodified (if that's what you want).

Edited for spelling, since I suck at that.
 
Apr 13, 2006 at 11:47 PM Post #2 of 15
For the uninitiated, FLAC does for WAV what ZIP or RAR do for digital files that don't store audio. FLAC is tailored to compress audio only, whereas ZIP and RAR have much more generic compression algorithms.
 
Apr 13, 2006 at 11:57 PM Post #4 of 15
you can also make MD5 sum of the wav file encode it and convert it to and back to wav and it will have to same sum. this is true for flac/monkeysaudio/apple lossless/OptimFROG/Shorten/True Audio/la/shorten/Wavpack/Bonk/LPAC/RKAU
 
Apr 14, 2006 at 12:10 AM Post #5 of 15
Thanks for clearing that up. THere were a lot of odd threads for a while that probably confused some newcomers. I was thinking about posting this myself but it wouldn't have been nearly as thorough. (Is that really what the word "thorough" looks like? Weird.) Anyway, thanks!
 
Apr 14, 2006 at 12:16 AM Post #6 of 15
Quote:

Originally Posted by Sycraft
Lossless compression


I think that's an oxymoron.
smily_headphones1.gif
 
Apr 14, 2006 at 12:18 AM Post #7 of 15
Quote:

Originally Posted by Cyrilix
I think that's an oxymoron.
smily_headphones1.gif



Um...you're kidding, I hope. Do you lose any data when using ZIP or RAR? FLAC/ALAC/WMA lossless are the same thing, but optimized for music files.
 
Apr 14, 2006 at 12:28 AM Post #8 of 15
If wav was the only way to have lossless, then yes, it would be an oxymoron. But as long as you can get any compression out of wav without going lossy, you can get lossless compression.. Just not as compressed as lossy
smily_headphones1.gif
 
Apr 14, 2006 at 1:10 AM Post #10 of 15
Quote:

Originally Posted by jagorev
Um...you're kidding, I hope. Do you lose any data when using ZIP or RAR? FLAC/ALAC/WMA lossless are the same thing, but optimized for music files.


Sure. You're effectively storing a signal in a more compact way. Your data loss (in the information theory sense) is the amount less space required to store the signal. Certainly the information of the signal is unaffected (by definition/construction), but information never was the same as data (to be specific, the later is simply an observation drawn on the former).

-Angler
etysmile.gif
 
Apr 14, 2006 at 1:25 AM Post #11 of 15
Quote:

Originally Posted by jagorev
Um...you're kidding, I hope. Do you lose any data when using ZIP or RAR? FLAC/ALAC/WMA lossless are the same thing, but optimized for music files.


I know that... I just thought it was funny saying "lossless compression", since the literal meaning of lossless means that nothing has been lost at all, right?

I know that if you have 00011111, you can write the data using some sort of algorithm that will make the filesize smaller, but my comment above was just a joke.
 
Apr 14, 2006 at 2:25 AM Post #13 of 15
Quote:

Originally Posted by angler31337
Sure. You're effectively storing a signal in a more compact way. Your data loss (in the information theory sense) is the amount less space required to store the signal. Certainly the information of the signal is unaffected (by definition/construction), but information never was the same as data (to be specific, the later is simply an observation drawn on the former).

-Angler
etysmile.gif



This is the first time I've seen information theory mentioned in any substantive context...

The deal with information being different from data is quite interesting. I don't know anything about the field in general, though.

From an audio perspective though it doesn't matter if "information" is lost, though
smily_headphones1.gif
 
Apr 14, 2006 at 3:00 AM Post #14 of 15
Excellent presentation of the lossless formats. Great method to compare the files and outputs.
I still think some people won't believe they sound the same for whatever reason they come up with.
 
Apr 14, 2006 at 3:02 AM Post #15 of 15
Quote:

Originally Posted by K2Grey
This is the first time I've seen information theory mentioned in any substantive context...

The deal with information being different from data is quite interesting. I don't know anything about the field in general, though.

From an audio perspective though it doesn't matter if "information" is lost, though
smily_headphones1.gif



I always try to impress. Actually I know very little about information theory except as it overlaps with modern statistics. It is a really neat field though.
biggrin.gif


-Angler
etysmile.gif
 

Users who are viewing this thread

Back
Top