What is the difference between WAV and FLAC?

31

5

My understanding is that the WAV and FLAC formats are containers for lossless audio. I have seen the FLAC format as being perhaps better because it is able to losslessly compress audio from say a WAV file.

However today I noticed that bleep is offering both WAV and FLAC files to download. Is their practice redundant or am I missing something?

After reading allquixotic and slhck answers I was curious as to the audio codec for the wav files in question. This is what I found

Input #0, wav, from 'Exai-001-Autechre-Fleure.wav':
  Duration: 00:04:51.39, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz,
                 stereo, s16, 1411 kb/s

Steven Penny

Posted 2013-02-17T21:37:31.993

Reputation: 7 294

Answers

38

You might be confused about different concepts:

  • FLAC is a lossless audio codec (its container also happens to be called FLAC, but the main idea here is the actual codec).
  • WAV, on the other hand, as a container can hold numerous kinds of audio codecs, but mostly, you'll find PCM-encoded audio.1

Since FLAC is all about mathematically lossless compression, FLAC files will be smaller than corresponding PCM-encoded WAV files, since PCM doesn't allow for lossless compression and just represents the data as-is.2

So, simply put: Take a WAV file with PCM-encoded audio, and the corresponding (mathematically equal) FLAC file will be a tad smaller. The downside is that FLAC is not as widely supported as WAV. For example, most (all?) operating systems won't play or convert FLAC files without extra software.

Bottom line, I'd say their practice is redundant but a nice gesture for folks who don't want to download massive amounts of data and prefer the compressed version.

1 – For example, variants of MP3 can also be stored in a .wav file.
2 – The analogy for images would be that BMP files contain the raw image data in an uncompressed form, whereas a (lossless) PNG is much smaller, but showing the exact same contents.

slhck

Posted 2013-02-17T21:37:31.993

Reputation: 182 472

note that bleep.com will sometimes offer "24-bit wav" or "16-bit flac" but not "24-bit flac" – Quetzalcoatl – 2018-04-07T00:43:03.290

2In response to Steven's added-on observation: "pcm_s16le" is ffmpeg's way of saying the audio format is LPCM, with each sample represented as a signed 16-bit integer, with each sample's bytes in little-endian order. With 44100 samples per second, times 2 channels (stereo), it works out to 1411 kilobits/second, which is just an indicator of how fat the audio data in the WAV is; it has no correlation to quality. In the FLAC, the audio data is described differently and the bitrate varies. But when the FLAC is played, it is decompressed to exactly the same LPCM audio data stream as in the WAV. – Mike Brown – 2013-05-27T18:48:43.693

7

FLAC is a compressed lossless audio stream, WAV is uncompressed lossless audio stream. FLAC is like ZIP in audio world, you can compress/uncompress the data multiple times without any loss. But compression ratio is better than ZIP, because this compression format is tailored specifically for audio.

Mikhail Kupchik

Posted 2013-02-17T21:37:31.993

Reputation: 2 381

-2

FLAC is superior to LPCM (WAV) in almost all aspects, but FLAC's support is very limited. Many devices (music systems, portable devices, TVs, etc.) cannot playback .flac files.

Dennis

Posted 2013-02-17T21:37:31.993

Reputation: 42 934

It's not superior in read time, since FLAC has to be decoded first. – naught101 – 2015-10-12T01:06:54.087

@Karan That's one way of looking at it. Another way is that the title is a loosely worded description the question body. Clearly the person asking the question put a little time into fleshing out exactly what they were after. – None – 2016-07-15T12:44:00.017

1#needs citation. This is pure opinion not backed by one single fact. – Tetsujin – 2017-02-12T08:17:05.240

This is basically a false claim. It's conflating things. Firstly, WAV isn't an audio format, it's a file format. WAV is a specification of how to write the audio data, but it doesn't say what that audio data should be. WAV files are actually very powerful in theory, because you can specify any codec you want for the data you're storing. In practice, most software will only process WAV files that contain uncompressed PCM data. – Jonathan Gilbert – 2019-01-04T06:25:42.947

In comparison, FLAC is not a file format or even an audio format, it is an audio encoding. It is a way of saying, "I want to store this sequence of samples", and getting back a sequence of bytes. A WAV file then has the structure to store those bytes for later retrieval. Since a WAV file lets you (requires you to) specify the codec for the data, you could put FLAC data into a WAV file. However, in practice people just store FLAC data raw, outside of a container, in files with the ".flac" extension. They have no structure, just raw (encoded) audio data. – Jonathan Gilbert – 2019-01-04T06:27:17.003

For both FLAC files and WAV files, the audio format is going to be some number of samples per second, and each sample is going to have a certain accuracy. The samples per second is very commonly either 44100 (CD audio) or 48000. The accuracy is almost always 16 bits per sample, but studio audio sometimes uses 24 bits per sample. WAV files are usually used to store the raw PCM data, without any special encoding, but they can represent any sample rate or bit depth you want. A commenter on another answer pointed out that boost often offers either 16- or 24-bit download options. – Jonathan Gilbert – 2019-01-04T06:29:12.787

The key point, though, is that data encoded in the FLAC file is actually identical to the data in a WAV file for the same audio format. You can actually convert a WAV file to a FLAC file and back and get, for all intents and purposes, the identical WAV file. When your computer plays a WAV file, it reads the raw sample data and sends it to the sound card. When it plays a FLAC file, it converts the compressed form back to the exact same sample data and sends it to the sound card. WAV and FLAC of the same sound cannot possibly have audible differences. – Jonathan Gilbert – 2019-01-04T06:30:24.867

So what is the advantage of FLAC? Size. That's it. They'll typically be about 50% the size of the WAV file, without losing any quality at all. Compare with MP3 files, which can be less than 10% the size, but are more than just a way of encoding the data. They achieve those compression ratios by throwing away some of the data (details your ears can't hear, typically). When you turn audio samples into an MP3 stream and then convert them back, you do not get the exact same original samples back. – Jonathan Gilbert – 2019-01-04T06:31:45.350

Doesn't really answer the question. – Karan – 2013-02-17T23:48:44.557

2Well, it doesn't really answer the title. The question in the body was why bleep would offer both formats considering. – Dennis – 2013-02-18T01:11:01.233

Yeah, but the question in the body is an add-on to the question in the title. – Karan – 2013-02-18T01:12:45.183

When I answered the question, the title was difference between wav and flac. It seemed to me that the only thing the OP was interesting in were bleep's motive. – Dennis – 2013-02-18T01:16:53.877

-2

WAV has a constant bit rate. That means even the silent parts are stored as 0 Hz and occupies space in the container.

FLAC on the other hand has a variable bit rate and eliminates the silence parts and stores only the part of the audio between 1 and 655,350 Hz. If any audio frequency in that range is not detected, say 0 Hz or anything above 655,350 Hz, FLAC treats it as silence and does not store it. As reference, humans can only hear frequencies in the range between 15 Hz and 20,000 Hz, which also narrows with age.

So if a song is long but has a lot of silent parts, then its FLAC size would be significantly smaller than its WAV file would be.

The reason why some audio stores offer both WAV and FLAC files is that audiophiles are particularly finicky about quality and they sometimes feel that FLAC, being of smaller size, is inferior to WAV.

I also feel that way, although I am perfectly aware that they deliver the exact same quality. Not getting the WAV file makes me feel that something is missing, which in fact is largely untrue if in reality, I will only be missing something that is not there and something that nobody in this world would be able to hear: even the bats.

James

Posted 2013-02-17T21:37:31.993

Reputation: 1

6

This isn't true. FLAC is lossless. That means that a WAV converted to FLAC and back again will contain exactly the same data. Also, both formats usually only contain data with samplerates at 44.1kHz (CD), 48kHz, or 192kHz (although there are a few other less common rates). By the Nyquist sampling theorem, only frequencies up to half the sampling rate can be recorded (so only frequencies < 22.05, 24, 96kHz, respectively). 655,350Hz is nonsense.

– naught101 – 2015-10-12T01:06:22.510

I'm really curious where does this magic constant (655350) even come from! My guess: (2^16 - 1) * 10. Remaining part of thought process is beyond me, though! – sunny moon – 2017-03-16T13:56:02.330

-10

WAV is superior to FLAC.

I’ve tested this on my rig with the start of a Mozart track (the first 30 seconds) and there were some artifacts which were only slightly greater represented on the wav. when compared to the flac. To someone who doesn’t understand audio and to the naked ear they’re almost identical.

Any kind of compression has some limiters. WAV is also used in studios for its raw accuracy.

Just some facts…

Any of those High-Res 24 bit /192 KHZ, DSD, or 32 bit/384 KHz are HUGE space wasters. The human frequency range is limited - and on a summit-fi rig of Hi-Fi separates with an amplifier, CD player, sound field processor, and tuner is able to extract ultrasonic frequencies when used with compatible headphones (5 HZ - 40 KHz) to the point of being able to feel these ultrasonic frequencies around you; even disrupting listening sessions when you will believe someone has stopped on the floor. This is possible with redbook CDs. You aren’t going to get any higher than that as far as sound quality goes. stand alone DAC's are also inferior to a top-flight cd player. If you really want to hear how it was recorded and in all its glory - go for TAD components (Pioneer) or Accuphase.

Cables can make a difference but not always. For example, a poor quality CCAW (copper clad aluminum wire) is inferior to pure copper. The only time a cable will make a difference on sound quality is when: 1st if the quality of the copper is not pure, and 2nd if the cable impedance has been tampered with by scam cable makers. At the end of the day, buy pure copper cables for your speakers. And for headphones make your own cables with pure copper. Silver cables on the other hand can sound more dynamic and “bright” and buying silver wire could benefit you if your speakers sound dull. Any special power cables are rip offs as well. So yes, cables can make a difference.

Measurements are sometimes inaccurate as the measurement system was not implemented perfectly. And of course, measurements don’t tell the whole story. If you look up how human beings actually hear frequencies you might understand the truth of this matter.

Dillon Bhai

Posted 2013-02-17T21:37:31.993

Reputation: 1

6There is nothing wrong with the FLAC codec itself that would introduce artifacts that aren't present in the source file. FLAC is a lossless compression codec, the definition of which is that when properly uncompressed it is identical to the source PCM audio.

That said, your setup might be introducing artifacts if the the decompression is more focussed on speed (e.g. real-time playback) vs. accuracy. – eToThePiIPower – 2014-06-27T22:21:28.267

4In other words: you can go from a .wav file to .flac and back to .wav and the files should be exactly the same. – Jens Erat – 2014-06-27T22:34:00.797

I'm not sure if this answers the main question (which is, the difference between two audio formats). It does develop about the auditory aspect but otherwise it isn't what was asked. I recommend you to look at the [about] page, to get a feel for how Superuser works. – Doktoro Reichard – 2014-06-28T00:11:15.130

2I think you're confusing psycoacoustic compression with data compression. Flac compresses data (which makes it comparatively 'expensive' to decompress and play compared to wav). Some of these claims make sense to me. That wav sounds better than flac, or that standalone DACs are inferior to one in a DVD player (which needs a dac anyway) less so. Nonetheless, these are the sort of things worth testing double blind I suppose. I also suspect if we're talking about "the last one percent" there's other factors like mastering in play that would have a bigger effect. – Journeyman Geek – 2014-06-28T01:08:21.153