Flac

Vincent Kars

WBF Technical Expert: Computer Audio
Jul 1, 2010
860
2
0
Over the years FLAC (Free Lossless Audio Codec) has become one of the most popular open source audio codecs.
It works like Zip; you can compress and decompress the audio without loss.
As FLAC is optimized for audio the compression is much better than with Zip.
Depending on the music the compression rate will be 30%-50%.

FLAC supports linear PCM audio:

  • 4 – 32 bits fixed point word
  • 1 Hz to 655,350 Hz sample rate in 1 Hz increments
  • 1 – 8 channels
FLAC's metadata system supports tags, cover art, seek tables, and cue sheets.
It runs on Windows, OSX and Linux.

The integrity of the audio data is insured by storing an MD5 signature of the original unencoded audio data in the file header, which can be compared against later during decoding or testing.

FLAC is very well supported.
There are two exceptions to this rule: iTunes and Windows Media Player.
Both Apple and Microsoft have a strong dislike for open source.
They want you to use their own proprietary formats.
Best solution is not to use their players.
Second best: there are workarounds to enable these players to play FLAC.

Compression
You can choose 0 – 8 where 0 is no and 8 the highest compression.
The compression ratio is a source of misunderstanding.
A lot of people thing that it works like the bitrates in MP3 so more or less loss.
The compression ratio simply tells how many CPU FLAC is allowed to use to find the best possible compression (linear prediction). The more time is allowed the higher the compression.
In practice 5 is often recommended as a nice compromise between coding time and file size.
Going from 5 to 8 in general results in a marginal smaller file.
Regardless of the compression ratio chosen, the result is always lossless

Bit rate
If you play a 16/44.1 track ( CD audio) ripped to WAV you see a bit rate of 1411 Kbit/s.
Play the same track in FLAC format and you will see a lower value , often around 700.
This confuses a lot of people.
If you play MP3 you see a lower bit rate too so they start wondering if FLAC is lossy too.
As FLAC is compressed, the same information is stored using less bits ( otherwise you can't get a smaller file….). The bit rate as displayed by your media player is the amount of bits per second read, not the bit rate after expansion to linear PCM.

From the FLAC website:
With FLAC you do not specify a bitrate like with some lossy codecs. It's more like specifying a quality with Vorbis or MPC, except with FLAC the quality is always "lossless" and the resulting bitrate is roughly proportional to the amount of information in the original signal. You cannot control the bitrate much and the result can be from around 100% of the input rate (if you are encoding noise), down to almost 0 (encoding silence).

Obvious the compression and therefore the bit rate you see varies with the complexity of the signal.
You will see differences between tracks but also within.
In essence it is VBR (Variable Bit Rate) but lossless all of the time.
 
First of all, almost all do including WAV.
In case of WAV there is no standard so portability of the tags is low.
FLAC uses OGG/Vorbis comments
MP3 uses ID3

In practice tags are simply stored in het header of the audio file (APE does it at the bottom)
How this is done varies from format to format.
As an example WAV: http://www.thewelltemperedcomputer.com/Lib/WavSpec.txt
 
For a time I had a very mixed environment FLAC, WMAL, APE and MP3
Also some where single file with CUE sheet.

The single file+cue sheet is a problem when tagging the "tracks" as there are no track as physical files.
WMAL is as good as FLAC but it won't play on Linux (my NAS).
In the end I decided to convert everything to 1 file per track and use only FLAC as lossless format.
dbPoweramp can do that quit fast.
J River Media Center I used most of the time as a splitter.
 
You can rip a CD to 1 file containing all of the tracks.
Obvious gapless playback is quranteed!

As the tagging schemas allow for album, title, etc. you can't tag the individual tracks as no tagging schema allows for title1, title2, etc.
The only way to that is using a CUE-sheet
http://www.thewelltemperedcomputer.com/SW/CueSheet_SW.htm

It describes where in this single file the track starts and what its title is.
A splitter use the timing information in the cue sheet to split the single file into a file per track
 
I started about 5 years ago in this Computer music business. I can tell you that the single file + cue sheet is often maddening. I am still in a mixed environment. I was experimenting with ripping and used ape and flac since they allowed me lossless compression.

I find myself drifting toward flac but for no clear reason. Ape should be as good and both are free. Any reason Vincent why you prefer flac over ape or have I misread you ?
 
I do “prefer” FLAC but have no true rationale.
APE might do the job as well.
FLAC I do think has a stronger support especially in the Linux world while APE is Win only.
FLAC might be convenient the moment you start with Linux/Squeezeserver
APE also is less frugal on resources when decoding. Can be a problem on a low power device.

I do think FLAC is the more flexible one.
In the end I don’t really mind.
Tools like dbPoweramp can convert the whole collection to another format when needed.
 
As always, I take your otherwise superbly written post and try to nitpick. I hope you forgive me but you mentioned a product of my old group and I feel compelled to answer :).

FLAC is very well supported.
There are two exceptions to this rule: iTunes and Windows Media Player.
Both Apple and Microsoft have a strong dislike for open source.
They want you to use their own proprietary formats.
Best solution is not to use their players.
While there is an element of truth to what you are saying the overriding motivation is not that. The real problem is patents.

With software we can write and give it away as "open source." That model works fine. However, if there are underlying patents that read on that source code, you do not get to convey the technology to someone else just because you give away the source. The implementor must still get a patent license.

Unfortunately, any type of signal processing like audio compression has a billion people making claims against it -- valid or otherwise. And in a nasty twist, the more more open its specification, the more people correctly or incorrectly, can lay claim on it. They can say, "look here, this part you stole from me."

Companies like Microsoft and Apple have been sued for billions of dollars for audio compression patents. I know, I was in one of them :(. Fortunately that case eventually worked out for the better but not before the first getting hit with a $1.53B award against Microsoft: http://en.wikipedia.org/wiki/Alcatel-Lucent_v._Microsoft

"The litigation money involved was $1.53 billion for first round of patent infringement case. Its final verdict was given in August 2007 at the U.S. District Court for the Southern District of California in San Diego. The damages award was reversed on appeal in September 2009 and returned for a separate trial on the amount of damages."

The above was due to support of MP3 in Windows. Apple was also the target of the same suit from what I recall.

We have a number of these home-brew technologies like Ogg Vofbis which fall in this category. Google is having the same problem now, trying to open source their video codec they bought from On2, only to realize that people won't take it even if they give it away.

Finally, as you know, both Microsoft and Apple support MPEG-4 so the stance is not purely against standards but yes, all else being equal, they like to have an advantage with an in-house format than not.
 
I use ape for the following reasons:

- It was available and developed before FLAC
- Given the same amount of encoding time, it is about 2% more efficient than FLAC
- Matt Ashland, that developed ape, is one of the developers of J. River Media Center. Since I use JRMC and know Matt from their forum, I use it for "relationship" reasons.

If I download from HDTracks, I leave the files as FLAC.
 
Hi

I had a Macbook Pro I was using as a music server and found myself using it less and less (for that purpose at least) because of the inability or would I say the refusal of iTunes to play FLAC. I may represent just one single person out of the vast majority that finds iTunes everything they ever wanted but after using foobar (my go-to music server software) or JRC (very, very good) I am seeing myself using the Apple products simply for controlling purposes aka Remote Controls ...
I have a hard time seing how in the world FLAC and Ape support would hurt Apple or MSoft ... but it was about FLAC so let's get back to the subject:
 
I explained that Frank. Look at Sony. They also don't support Flac on PS3 despite lots of demand. The IP (patent) situation is ugly.
 
Steve, Apple's (just like MS's) is proprietary. FLAC works with virtually everything out there. By now the handwriting is on the wall. FLAC is THE format to use.
 
I use AirTunes (now called AirPlay) to pipe music to my system. I rip all CDs to Apple Lossless Audio Codec (ALAC) using dBpoweramp. For most practical purposes, ALAC works as well as FLAC. Right now I have stuck with iTunes because (1) I use two iPods on a daily basis and I find that syncing music and podcasts is effortless; and (2) AirPlay really works quite well for streaming standard resolution music wirelessly to my Airport Express and DAC. I don't really like the idea of being locked down to iTunes but for now it fits my needs better than anything else.
 

About us

  • What’s Best Forum is THE forum for high end audio, product reviews, advice and sharing experiences on the best of everything else. This is THE place where audiophiles and audio companies discuss vintage, contemporary and new audio products, music servers, music streamers, computer audio, digital-to-analog converters, turntables, phono stages, cartridges, reel-to-reel tape machines, speakers, headphones and tube and solid-state amplification. Founded in 2010 What’s Best Forum invites intelligent and courteous people of all interests and backgrounds to describe and discuss the best of everything. From beginners to life-long hobbyists to industry professionals, we enjoy learning about new things and meeting new people, and participating in spirited debates.

Quick Navigation

User Menu