FLAC vs MP3

FLAC vs MP3 – Beginners Guide

FLAC vs MP3… Fight!  If you are reading this post, I’m sure you have a few questions.  What format is better?  When to use each format?  Or maybe you are just curious and want to improve your understanding.  Whatever the reason, we will cover it all in this article.

FLAC files are a lossless encoding format that retains full CD-quality audio with a file size half that of a WAV. This makes FLAC a good ‘middle ground’ for audiophiles.  MP3 files are slightly lesser quality but much smaller in file size making them a better option for sharing, streaming, and uploading onto portable devices.

What is a FLAC file?

FLAC, or Free Losses Audio Codec, is a lossless audio format created to maintain a high level of audio quality but with a fraction of the file size compared to a WAV.

Audio sources encoded to FLAC can be reduced up to 50–70% of their original size, although the final size depends on how much audio data is being compressed.

FLAC files use a 0 to 8 rating that determines the level of compression, 8 being highly compressed.

Although the quality between 0 and 8 remains relatively the same, the encoding and decoding time is greatly increased and higher levels of compression can be more demanding on the CPU.

FLAC ‘Quality’ is determined by the ‘sample rate’, and the ‘bit depth’.  Sample rates start at 22,050hz, 32,000hz, 44,1000hz, 48,000hz, 88,200, 96,000hz and go up to 192,000hz, and bit size can generally range from 8 to 32 bits. 

FLAC vs MP3

Because FLAC files are lossless, the files can be quite large in comparison to MP3.  The file size can vary quite a lot depending on what level of compression is used, but a one-minute audio clip using the industry-standard sample rate and bit depth will be around 9mb which is much smaller than a WAV file.

The human ear can hear frequencies anywhere from 20hz (Very low bass frequency) to 20khz (Very high pitch frequency), and FLAC files are designed to capture this entire range. 

For these reasons, FLAC files are becoming a popular choice for music lovers and audiophiles.

How FLAC files are encoded

FLAC files are encoded in 3 stages. 

  • First, the audio data is broken up into separate blocks.
  • Then each block is referenced with a mathematical prediction.
  • And lastly, the signal is reconstructed using the mathematical prediction.

Blocking. The audio data is broken up into many blocks that can vary in size. The size of the block is usually determined by many factors, including the sample rate, sonic characteristics over time, etc.

In the case of stereo streams, the encoder will create mid and side signals based on the average and difference (respectively) of the left and right channels. The encoder will then pass the best form of the signal to the next stage.

Prediction. The block is passed through a prediction stage where the encoder tries to find a mathematical description of the audio signal. This description is typically much smaller than the raw signal itself.

Since the methods of prediction are known to both the encoder and decoder, only the parameters of the predictor need be included in the compressed stream.

Residual coding. During encoding, the predictor describes the encoding in order to reconstruct the signal.  If the predictor does not describe the signal exactly, the difference between the original signal and the predicted signal must be coded losslessly.

What is an MP3 file?

MP3 is a digital audio format designed by the company Moving Picture Experts Group to replicate CD audio quality but with much smaller file size.

MP3 files are also referred to as MPEG Layer 3 files and are exactly the same file format.

A compressed MP3 file can be as little as 10% of the original WAV file size.  This means by using MP3 compression, a 50mb WAV file can be compressed to as little as 5MB.

In order to make the file size so small, some of the original audio data must be removed.  This process is called ‘Lossy Compression’ and a bi-product of this compression is a slight loss in audio quality.

FLAC vs MP3
FLAC vs MP3

So how does the algorithm know what sounds to remove?  Well, that comes down a process called Temperal Noise Shaping.

Many different MP3 bitrate options are available such as 48, 56, 64, 96, 192, 256, 320 kbps (kilobits per second). 

The bitrate refers to how much data is stored per second. For example, a 256kbps song from iTunes will have 256 kilobits of data stored every second.

So, in other words, the higher the bitrate, the more data is getting processed and the higher the quality. The lower the bitrate, the less data being processed and the lower the quality.

Lossless FLAC files are normally 1024kbps, compared to MP3 that can be 320kbps maximum. 

MP3 can also use two different types of MP3 compression (Coding) – Constant bitrate, or variable bitrate.

Constant bitrate is exactly that, a constant bitrate through the entirety of the audio clip.  This means if an MP3 file is 192kbps constant bitrate, the compression will be at 192kbps through the entire audio clip.

Variable bitrate is a more advanced type of compression where the bit rate will continuously change over time depending on where the coding algorithm feels it requires more or less compression.  If the algorithm thinks that certain parts of the song can be compressed to 96kbps and other parts to 320kbps it can do so accordingly.

How MP3 files are encoded

We mentioned earlier that the lost or removed data is determined by the temporal noise shaping process, but what exactly is that?

Temperal noise shaping uses an algorithm that is capable of making a decision of what frequencies to remove from the signal and will only remove frequencies that are barely audible to the human ear.

These algorithms dictate the rules of the compression. 

There are a lot of different frequencies and data in the background of a signal that the human ear can’t easily hear.  These can be removed from an audio signal without significantly altering the sound but still allow for a good amount of compression.

We now know that the human ear can hear the frequency range of 20hz to 20khz.  MP3 compression can reduce this range to 20hz to 18khz or even less. 

MP3 – 18kHz
WAV – 20kHz

To the average listener, this reduction is probably not audible, but to the seasoned sound engineer or producer, the loss of dynamic range is simply not acceptable.

The different algorithms all have a slightly different character so it’s quite possible to have the same sound processed with different MP3 algorithms that sound slightly different.

Problems with MP3 compression

Because there is a loss of data from the audio signal, there are certain problems that can arise from this compression.

  • Weak low and sub frequencies

One of the many problems with MP3 encoding is its ability to turn a rock-solid bassline into a floppy mess.

This is because lower frequency waveforms are quite long so there is very little amplitude difference over the short analysis window the encoder operates in, meaning the bass won’t fully cycle in the time it takes for the algorithm analysis to cycle.

There are much better encoding formats that allow for stronger preservation of low and sub frequencies, for example, the AAC format.  Check the ‘Common Alternative Formats’ at the end of this article.

  • Reduced Dynamic range

Reduced dynamic range occurs when the compression algorithm removes frequencies that the human ear finds difficult to hear.

The average human is capable of perceiving a dynamic range of 20hz to 20khz.

MP3 compression will generally remove anything above the 18-kHz as these higher frequencies are not as noticeable.

The higher the compression and lower the bitrate, the more the reduction in dynamic range.

  • Unwanted noise added

Because the coding algorithms rely on the ear’s inability to hear certain frequencies, noise can sometimes be generated as a by-product of this encoding that sits in the same place of the removed frequencies.

This added noise can be very difficult to hear for the average listener, but easily visible under closer inspection using a spectrum analyzer.

  • Wanted sounds removed

The algorithms used for compression have been told to follow a set of rules and these rules tell them what to remove and what to leave in place. 

This is fine under the right circumstances but because the signal input is constantly different the algorithm can sometimes remove sounds that are audible to the listener. 

This is why some developers create their own algorithms for audio compression. 

  • Change in signal volume levels

Because the MP3 encoding removes certain frequencies, this can, in turn, make other frequencies seem a lot louder than they were intended to.

The volume of these frequencies does not increase, it is only our sense perception that tricks our mind into thinking those frequencies are louder than they actually are. 

This is called ‘perceived volume’ and is a complex phenomenon not entirely understood by experts.

  • Double Speak

Another issue that can arise from MP3 encoding is audio timing errors.

Generally, this artifact is more prominent on vocals and can make a single voice sound like it has been layered, double-tracked, or made robotic. 

These artifacts are more noticeable in lower MP3 bitrates.

FLAC Pros and Cons – FLAC vs MP3

Pros

  • High-Quality Audio

One of the reasons that FLAC is getting more popular is because of the high-quality output over MP3.

Because the FLAC format is lossless it retains all quality and information from the original recording.

  • Smaller file size

Another reason is the smaller file size in comparison to WAV.  FLAC can be reduced up to 50–70% in size.

Cons

  • Large File Size

In comparison to MP3, FLAC files can be quite large in size.  An MP3 with a file size of 10MB would scale to 50 or 60MB in FLAC format.

This size can be reduced with higher levels of compression, although a higher level of compression requires more CPU power to process.

  • Uses more CPU

The higher levels of compression will use more computer resources.  This is ok if using a laptop or other device that is plugged into mains.

On the other hand, using FLAC on portable devices can have a significant impact on battery life.

  • Not easy to share

Although FLAC files are small in comparison to WAV, they are still large in comparison to MP3 making them quite difficult to share.

  • Not good for portable devices

FLAC files are significantly larger than MP3 and the larger file sizes will quickly fill up a hard drive or portable device.

Below are calculations on how many songs can fit on a 64gb device.

  • MP3 – 8000 songs
  • FLAC –1600 songs

MP3 Pros and Cons – FLAC vs MP3

Pros

  • Small File size

MP3s are a fraction of the size of FLAC files, as little as 20%.

This makes them extremely efficient when large quantities need to be stored on a small device or laptop.

  • Very easy to share

The small file size makes sharing MP3s very easy. 

  • Good for portable devices

Because of MP3s small file size, they are one of the best options when wanting to store a large number of files onto a small handheld device.

Cons

  • Lower Audio Quality

The maximum MP3 bitrate quality is 320kbps. 

This is very low quality in comparison to a FLAC of 1024kbps, but still, the average listener would struggle to notice any difference.

‘KBPS’ refers to file size but is still a decent representation of audio quality.

  • Weak Low End

One of the biggest problems with MP3 encoding is the ability to strip an audio sample of its low end or bass.

This can make the compressed version sound completely different from the original.

  • Reduced Dynamic range

Reduced dynamic range is more prominent on lower bitrate MP3 files.

320kbps MP3 files will still maintain a fair about of dynamic range but still not like a FLAC file.

Which one is better? FLAC vs MP3

There is no definitive answer to this question as each format serves the purpose it was intended for.

MP3s are generally used for sharing music, loading music onto handheld devices, or upload your music to your website as it increases page load times.

FLAC files sit in the middle between MP3 and WAV.  They are good because of the quality, but the file size can be quite large.

  • If HDD space is no issue, I would definitely go with FLAC as the audio quality makes listening to music a much more enjoyable experience.
  • If your lacking room on your HDD, then MP3 would be the best option as the file size is small and the quality is still decent.

Common Alternative Formats

  • WAV

WAV files are a lossless audio format that retains the utmost audio quality. 

The file size can be 1000% that of an MP3 file.

An MP3 of 10BM would calculate to 100MB in WAV.

  • OGG

An OGG file is a compressed audio file that is similar to an MP3 file in size but retains better overall quality by encoding with a variable bitrate.

This makes it a popular format for streaming services such as Spotify and Google Play Music.

Summary – FLAC vs MP3

Well, there you have it.  I hope this FLAC vs MP3 article has helped provide you with a clear understanding of both FLAC and MP3 files and how they are processed and used.

Now you can use this knowledge to make a more educated decision on what format to use in the future.

Want to learn more about audio formats?

As always, good luck and happy producing.