Splitting FLAC Files from the Terminal

Published: 2021-07-28
Last Updated: 2022-10-13

Performing a clean high quality rip of a CD often results with a large single file such as a FLAC or WAV depending on how it's been ripped. In my case, it's a big .flac audio file which includes several tracks along with a .cue file which includes track start times. I've tried a variety of GUI applications, but I've found that the easiest and most simplest way of splitting up these types of audio files is to just do it in a terminal.

First, be sure that cuetools shntool and flac are installed which will allow you to run cuebreakpoints and shnsplit. If your single file happens to be a wave (.wv) then also install wavpack. The tool cuebreakpoints reads the break-points from the cue file which can be piped into shnsplit which is the program used to split up the tracks from the single file:

sudo pacman -Sy cuetools shntool flac

Now, navigate to the folder where the cue and flac files are located and run the following command:

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

The output is a series of flac files, depending on how many tracks are identified in the cue sheet. By default, ID3 tags are absent, but you can manually tag the output files with:

cuetag.sh file.cue *.flac

Note: If you're working with a wave file (with the .wv extension), I like to convert to FLAC before splitting:

wvunpack audiofile.wv -o - | flac - -o audiofile.flac

Thanks for reading. Feel free to send comments, questions, or recommendations to hey@chuck.is