HydrogenAudio

Lossless Audio Compression => FLAC => Topic started by: John Lockwood on 2011-02-23 15:02:46

Title: Tips for dealing with the dreaded FLAC & CUE files on a Mac
Post by: John Lockwood on 2011-02-23 15:02:46
I recently wanted to burn some FLAC and CUE files to audio CDs and normally prefer using Macs. Having seen various plaintive requests for help from Mac users on this topic when looking for a solution myself, I thought I would post the following as potential help for others.

Firstly some background for those less knowledgable about this sort of thing -

CUE files generally are a text file that refers to an accompanying single large file that contains multiple audio tracks, so typically you might have a CUE file and a single large file containing all the tracks from a CD and the CUE file defines where each track starts and ends. Most commonly the large file is a 'binary' file which is an exact uncompressed copy of the binary data from the CD however it is possible for this to be in a variety of formats such as PCM (Pulse Code Modulation), WAV, or FLAC.

It is also possible for a CUE file to refer to multiple music files where each music file represents an individual track, however it seems fewer utilities understand this.

As an aside, I noticed that often the CUE files referred to WAV music files even if the accompanying music files were for example in FLAC format and this would cause errors. It is once you notice this easy to fix by either editing the CUE file (remember it is a text file) and doing a find/replace to change say WAV to FLAC, or separately converting the FLAC files to say WAV files to match what the CUE file says.

If we firstly consider the case of a CUE file and multiple music tracks (not one single large file) then one can simply ignore the CUE file and add the music files to a suitable CD burning program. Toast for the Mac for example will happily accept FLAC, Apple Lossless, AIFF, WAV or PCM files.

Note: Toast does support FLAC files

Note: Toast will not accept a CUE file pointing to multiple music files. (Of any format.)

However one issue I noted that might upset some people is that in Toast one cannot enter an arbitrary delay between a pair of tracks, e.g. 1.1 seconds, one can only select set values from a drop down list, e.g. 0.5, 1.0, 2.0 seconds.

Other CD burning applications for the Mac accept various formats but most do not support FLAC. Other Mac burning applications to look at are "Burn" and "Liquid CD".

If you don't have Toast and need to convert these individual FLAC files, then an excellent free utility called XLD will convert FLAC to other lossless formats such as WAV, PCM or Apple Lossless. I find XLD to be better in this instance than "Max" as XLD has an option to convert and keep the same bit resolution as the original rather than you having to decide, also Max has too many choices as to which converter to use.

So the above covers burning multiple FLAC files to an audio CD and if necessary converting them (losslessly) first.

However what if you have a single large music file and the accompanying CUE file showing how to split it? Toast will only cope with this if the music file is a binary file, it will not cope with it being a FLAC or WAV file. Often downloads will be in FLAC format to save space and time needed to download.

Note: This is despite the fact Toast will read individual FLAC files.

For this I found articles suggesting converting the single large FLAC files to a single large WAV file, however these articles suggested that you then had to (somehow) skip over the header of the WAV file which otherwise resulted in a brief static click when the result was played as an audio CD.

I found however that converting the FLAC file to a PCM file and renaming the file extension to .BIN and then editing the CUE file which originally referred to the FLAC file to use the .BIN file extension and BINARY type (when you look at a CUE file this should be fairly obvious) avoided this hassle.

It seems a PCM file is effectively a binary representation and has no header that causes a problem, certainly when I did this with Toast I had no annoying clicks and it played fine afterwards.

I used XLD to open the original CUE file which was pointing to the single FLAC file, and told XLD to convert to a single PCM file and not to  split the file.

Note: XLD can use a CUE file to split a single large music file, so one option would be to split in to individual FLAC (or WAV) files which Toast and other programs can use.

At this stage we have effectively a CUE file and a matching bin (binary) file which Toast will accept. The advantage of this approach rather than splitting in to individual FLAC (or other format) files, is that if the CUE file was properly created originally, it can and will contain precise inter-track gaps e.g. 1.13 seconds. Toast while it will not let you manually set such precise gaps, does support reading and using them from a CUE file.

It is possible with XLD to open a CUE file referring to multiple individual FLAC files and convert to a single PCM file with accompanying CUE file and effectively have a CUE and BIN file. (Remember to change the file extension to .bin)

Note: It appears Liquid CD while it also has specific set gaps in its drop down menu e.g. 0.5, 1.0, 2.0 etc., it will unlike Toast let you manually over-write these with your own times although it is limited to a single decimal point of precision e.g. 1.1 and not 1.13.

Note: Liquid CD does not support FLAC.


Let me know if you have any questions.
Title: Tips for dealing with the dreaded FLAC & CUE files on a Mac
Post by: mjb2006 on 2011-02-24 00:35:36
If we firstly consider the case of a CUE file and multiple music tracks (not one single large file) then one can simply ignore the CUE file and add the music files to a suitable CD burning program.

Well, if you do that, and if the cue sheet contains any CATALOG, TITLE, PERFORMER, SONGWRITER, ISRC, FLAGS, PRE-GAP, or INDEX info (besides INDEX 01), then your CD will be missing this data and will not be an "exact copy". The audio samples and track boundaries will be correct, but the disc won't have the embedded codes that enable the CD player to show sub-tracks (like the "count-up to 0:00" in the 'gaps' between tracks) or CD-Text info, and it may not play back with the proper EQ (if FLAGS PRE exists).
Title: Tips for dealing with the dreaded FLAC & CUE files on a Mac
Post by: John Lockwood on 2011-02-24 12:23:16
If we firstly consider the case of a CUE file and multiple music tracks (not one single large file) then one can simply ignore the CUE file and add the music files to a suitable CD burning program.

Well, if you do that, and if the cue sheet contains any CATALOG, TITLE, PERFORMER, SONGWRITER, ISRC, FLAGS, PRE-GAP, or INDEX info (besides INDEX 01), then your CD will be missing this data and will not be an "exact copy". The audio samples and track boundaries will be correct, but the disc won't have the embedded codes that enable the CD player to show sub-tracks (like the "count-up to 0:00" in the 'gaps' between tracks) or CD-Text info, and it may not play back with the proper EQ (if FLAGS PRE exists).


If you have a CUE file with individual track music files, then at least the ones I have seen (not made by me) have no PRE-GAP information in them presumably because it only refers to single track files.

The other information or most of it, would be in the embedded meta-tags of the FLAC files and would be used by a suitable burning application to create CD-TEXT data which I presume is what you are referring to. This information can also be obtaining by using FreeDB or CDDB.

My article was not to describe best practice for creating CUE files, but was to describe how to cope with existing ones.
Title: Tips for dealing with the dreaded FLAC & CUE files on a Mac
Post by: dv1989 on 2011-02-24 12:33:07
Toast for the Mac for example will happily accept FLAC, Apple Lossless, AIFF, WAV or PCM files.

Note: Toast does support FLAC files
Of these conflicting statements, I assume the former is unintentional, given the remainder of your post.