How do I split a flac with a cue?

82,352

Solution 1

If you have cue set to use k3b in in the filetype settings, k3b will automatically split the file if you open the cue file, and allow you to re-rip.

Solution 2

Shnsplit can read a cue file directly, which also means it can access the other data from the cue file (not just the breakpoints) and generate nicer filenames than split-*.flac:

shnsplit -f file.cue -t %n-%t -o flac file.flac

Granted, this makes it more difficult to use cuetag.sh if the original flac file is in the same directory.

Solution 3

Flacon is an intuitive open-source GUI that does exactly that: split a FLAC with a CUE.

Flacon extracts individual tracks from one big audio file containing the entire album of music and saves them as separate audio files. To do this, it uses information from the appropriate CUE file.

It supports among other things:

Supported input formats: WAV, FLAC, APE, WavPack, True Audio (TTA).

Supported out formats: FLAC, WAV, WavPack, AAC, OGG or MP3.

Automatic character set detection for CUE files.

To use it you only need to open the *.cue file with Flacon. It should then automatically detect the big *.flac file (if not, you can specify this manually), and then you should select Flac output format (and optionally configure the encoder), and start the conversion process.

Flacon v5.4.0

Solution 4

I only know a CLI way. You will need cuetools and shntool.

cuebreakpoints file.cue | shnsplit -o flac file.flac
cuetag.sh file.cue "split-*".flac

Solution 5

if high-quality files are being used, shnsplit is happily erroring out with

shnsplit: error: m:ss.ff format can only be used with CD-quality files

fortunately the flac binary supports --skip=mm:ss.ss and --until=mm:ss.ss so a script can use cuebreakpoints like this:

[..]
time[0]="00:00.00"
c=1
for ts in $(cuebreakpoints "${cue_file}"); do
    time[${c}]=${ts}
    c=$((c+1))
done
time[${c}]='-0'
for ((i=0;i<$((${#time[@]}-1));i++)); do
    trackno=$(($i+1))
    TRACKNUMBER="$(printf %02d ${trackno})"
    title="$(cueprint --track-number ${trackno} -t '%t' "${cue_file}")"
    flac --silent --exhaustive-model-search --skip=${time[$i]} --until=${time[$(($i+1))]} --tag=ARTIST="${ARTIST}" --tag=ALBUM="${ALBUM}" --tag=DATE="${DATE}" --tag=TITLE="${title}" --tag=TRACKNUMBER="${TRACKNUMBER}" "${aud_file}" --output-name="${TRACKNUMBER}-${title}.flac"
done
Share:
82,352

Related videos on Youtube

xenoterracide
Author by

xenoterracide

Former Linux System Administrator, now full time Java Software Engineer.

Updated on September 18, 2022

Comments

  • xenoterracide
    xenoterracide almost 2 years

    I've got a full album flac and a cue file for it. How can I split this into a flac per track?

    I'm a KDE user, so I would prefer a KDE/Qt way. I would like to see command line and other GUI answers as well, but they are not my preferred method.

  • boehj
    boehj about 13 years
    Thanks for this Kambus. I've been using cuebreakpoints file.cue | shnsplit -o flac file.flac for a long time. The 2nd bit is going to help a lot!
  • slm
    slm over 10 years
    Welcome to Unix & Linux Stack Exchange! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
  • hayath786
    hayath786 over 10 years
    cuetag seems to break on filenames containing spaces but after removing them it worked.
  • jwbensley
    jwbensley about 10 years
    Fellow debian users: sudo apt-get install cuetools shntool
  • wolfmanx
    wolfmanx over 6 years
    You might want to change if os.path.isfile(tmpfile) to if tmpfile != filename and os.path.isfile(tmpfile) to avoid deleting the original file on error.
  • wolfmanx
    wolfmanx over 6 years
    The condition for setting the track artist must be if len(records)>0.
  • coffekid
    coffekid over 6 years
    This is the only method that worked for me.
  • Matthias Urlichs
    Matthias Urlichs over 4 years
    cuetools already depends on flac, so …
  • coffekid
    coffekid about 4 years
    I don't like to use UI for things I can do on the terminal, but I was struggling with an album, and this was the only way of splitting the files. You deserve a beer now man
  • Gabriel Hautclocq
    Gabriel Hautclocq over 3 years
    On Debian 10 there is a bug with 24 bits flacs. It won't split. It works fine on 16 bits files though.
  • bomben
    bomben almost 3 years
    I did this and my single flac files are not playable.
  • Jocelyn delalande
    Jocelyn delalande almost 3 years
    On Debian Buster, adding debian-multimedia.org repository and installing monkeys-audio package did the trick.
  • Diogo Eichert
    Diogo Eichert almost 3 years
    Thanks for this answer. I've been looking for a tool exactly like this for a long time now. Excellent recommendation.