What is the difference between WAV and FLAC?

141,312

Solution 1

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.

Solution 2

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.

Share:
141,312

Related videos on Youtube

Zombo
Author by

Zombo

Updated on September 18, 2022

Comments

  • Zombo
    Zombo almost 2 years

    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
    
  • Karan
    Karan over 11 years
    Doesn't really answer the question.
  • Dennis
    Dennis over 11 years
    Well, it doesn't really answer the title. The question in the body was why bleep would offer both formats considering.
  • Karan
    Karan over 11 years
    Yeah, but the question in the body is an add-on to the question in the title.
  • Dennis
    Dennis over 11 years
    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.
  • Mike Brown
    Mike Brown about 11 years
    In 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.
  • eToThePiIPower
    eToThePiIPower about 10 years
    There 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.
  • Jens Erat
    Jens Erat about 10 years
    In other words: you can go from a .wav file to .flac and back to .wav and the files should be exactly the same.
  • Doktoro Reichard
    Doktoro Reichard almost 10 years
    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 tour page, to get a feel for how Superuser works.
  • Thalys
    Thalys almost 10 years
    I 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.
  • naught101
    naught101 over 8 years
    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
    naught101 over 8 years
    It's not superior in read time, since FLAC has to be decoded first.
  • A Z
    A Z almost 8 years
    @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.
  • Tetsujin
    Tetsujin over 7 years
    #needs citation. This is pure opinion not backed by one single fact.
  • sunny moon
    sunny moon over 7 years
    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!
  • Quetzalcoatl
    Quetzalcoatl about 6 years
    note that bleep.com will sometimes offer "24-bit wav" or "16-bit flac" but not "24-bit flac"
  • Jonathan Gilbert
    Jonathan Gilbert over 5 years
    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
    Jonathan Gilbert over 5 years
    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
    Jonathan Gilbert over 5 years
    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
    Jonathan Gilbert over 5 years
    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
    Jonathan Gilbert over 5 years
    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.
  • phuclv
    phuclv over 3 years
    Lossless means the sampled byte stream is exactly the same before and after compression
  • phuclv
    phuclv over 3 years
    see also comments in the below answer. Like Journeyman Geek said, it seems you're confusing psycoacoustic compression with data compression