Split flac by cue file in Debian / Ubuntu / Linux

Update: I found  split2flac,which does all this automatically.

From aidanjm’s stuff :

Lossless audio files can be split by cue file using “shnsplit” (part of the “shntool” package). You will also need the “cuebreakpoints” tool (part of the “cuetools” package) and “cuetag” to transfer the tags.

To install cuetools and shntool in Ubuntu/ Kubuntu, open a terminal window and enter the following:

sudo apt-get install cuetools shntool

You will also need software for your prefered lossless audio format. For FLAC you need to install “flac”.

Shnsplit requires a list of break-points with which to split an audio file. Conveniently, cuebreakpoints prints the break-points from a cue or toc file in a format that can be used by shnsplit. You can pipe the output of cuebreakpoints to shnsplit as follows:

cuebreakpoints sample.cue | shnsplit -o flac sample.flac

Or, without cuebreakpoints

shnsplit -f sample.cue -o flac -t “%n. %t” sample.flac < sample.cue

In this example, a flac file called “sample.flac” is split according to the break-points contained in “sample.cue” and the results are output in the flac format.

The output file format is specified via the “-o” option. If you don’t specify an output format your split files will be in shntool’s default format (i.e., wave files, “wav”).

To split a monkey’s audio file by cue file and output the results in the flac format:

cuebreakpoints sample.cue | shnsplit -o flac sample.ape

Note that a default prefix “split-track” is used to name the output files. (The default output format is split-track01, split-track02, split-track03, …). You can specify your own prefix via the “-a” option.

To see all the options for shntool split type “shntool split -h” or “shnsplit -h”.

Pay special attention to the -t fmt option to rename the split files:

shnsplit -f sample.cue -o flac -t “%n. %t” sample.flac < sample.cue

Transferring tags

The audio files output by shnsplit do not contain tag data. However you can use the “cuetag” script (installed as part of the cuetools package) to transfer tag data directly from a cue file to your split audio files. You specify the individual audio files corresponding to the tracks contained in your cue file as follows:

cuetag sample.cue split-track01.flac split-track02.flac split-track03.flac split-track04.flac

This will transfer the tag data contained in “sample.cue” to the flac audio tracks “split-track01.flac” “split-track02.flac” “split-track03.flac” and “split-track04.flac”.

The above command could be streamlined as:

cuetag sample.cue split-track*.flac or cuetag sample.cue *.*.flac

Cuetag works with flac, ogg and mp3 files. The cuetag script is not currently able to handle file names containing spaces.

Update: I found  split2flac,which does all this automatically.

12 thoughts on “Split flac by cue file in Debian / Ubuntu / Linux

  1. Pingback: Split flac by cue file in Debian / Ubuntu / Linux « bytebin « Pintér Pál a weben
  2. Try Flacon instead, native Ubuntu, has gui, found it in Software Center. Splits & converts FLAC/APE/CUE to various formats. Found it last night, works perfect :-D

    • … but that’s a much more complicated solution. Flacon is an audio converter. I think if you want to just split the files, a more simple approach like split2flac is preferable.
      And native Ubuntu installable from PPA is a disadvantage to me, since now I use Debian exclusively (much better :) ).

  3. Pingback: Monkey Audio (Ape) su Linux Debian « Blog
  4. Besides acting as a powerful Video/Audio Converter, iDealshare VideoGo is also a professional CUE Splitter which has both Mac and Windows version. It can easily split all kinds of CUE associated audio into individual audio tracks as well as keep the same audio format or convert to other format with high output audio quality.

    Key Features:
    Split MP3, FLAC, APE, OGG, WAV, WMA, DTS, MPC, WV, TAK, TTA, AAC, AIFF, AMR, AU, RA, and other popular audio formats as soon as they have a CUE text file embedded within them or have an external .cue file.
    Split audio into separate audio tracks as well as keep the same audio format like split FLAC CUE into separate FLAC tracks, split WAV CUE into individual WAV files.
    Split audio into separate audio tracks as well as change the audio format like split FLAC CUE album into individual MP3, WAV, WMA, AAC etc audio tracks, split APE album to multiple WAV, M4A or AIFF files, split TAK podcast to MP3 audio tracks and etc

  5. Acting as a professional Splitter, Bigasoft FLAC Converter can fast load numerous FLAC files and split them to multiple tracks based on associated .cue file in batch.

    This Splitter can solve the following issue:

    Split FLAC files and convert FLAC to MP3 or 320kbps MP3 in one step;
    Split FLAC files and convert FLAC to WAV or 24 bit WAV in one step;
    Split FLAC files and convert FLAC to ALAC in one step;
    Split FLAC files and convert FLAC to M4A, OGG, AAC, etc in one step;
    Split FLAC files to multiple single tracks in FLAC;
    Split FLAC files and convert FLAC on Windows XP, Vista, Windows 7;
    Split FLAC files and convert FLAC on Mac, OS X Lion.

    • 2013/10/29 at 12:09

      But it doesn’t work in Linux.

      It costs $25.

      It’s not FREE software.

  6. Pingback: BGM en formato FLAC | Degas' RO Journal
  7. Pingback: Split large FLAC, MP3, OGG, WAV files from CUE sheets - split2flac tool -
  8. Pingback: Splitting a Surround Sound Audio File in Ubuntu – Terence Eden's Blog

Leave a reply to Anonymous Cancel reply