LinuxCommandLibrary

shnsplit

Split a single audio file into tracks

TLDR

Split a .wav + .cue file into multiple files

$ shnsplit -f [path/to/file.cue] [path/to/file.wav]
copy

Show supported formats
$ shnsplit -a
copy

Split a .flac file into multiple files
$ shnsplit -f [path/to/file.cue] -o flac [path/to/file.flac]
copy

Split a .wav file into files of the form "track-number - album - title"
$ shnsplit -f [path/to/file.cue] [path/to/file.wav] -t "%n - %a - %t"
copy

SYNOPSIS

shnsplit [-f format] [-r rip_file] [-a] [-n] [-d dirname] [-o format] [-t cue_file] [input_file ...]
Note: The most common usage involves specifying both a CUE file and an output format, with the input_file often being the last argument.

PARAMETERS

input_file ...
    The path(s) to the large audio file(s) to be split. This is typically a .shn, .flac, .ape, or .wav file.

-t cue_file
    Specifies the path to the CUE sheet file that defines the track boundaries and metadata for splitting.

-o format
    Determines the output format for the individual track files (e.g., flac, wav, ape, shn, wv). Requires appropriate codecs to be installed.

-f format
    Forces the input audio format. Useful if shnsplit cannot automatically determine the file type.

-d dirname
    Specifies an existing directory where the split audio files will be placed.

-n
    Performs a 'dry run'. It will show what files would be created without actually performing the splitting operation.

-a
    Appends to existing output files (if applicable, typically for rip files, not individual tracks).

-r rip_file
    Generates a 'rip' file (a text file summarizing the split operation) instead of splitting audio.

DESCRIPTION

shnsplit is a command-line utility designed to split a single large audio file (often a lossless audio format like Shorten, FLAC, APE, or WAV) into multiple smaller, individual track files. It primarily uses a CUE sheet (.cue file) to define the exact start and end points for each track, along with metadata such as track titles and artist information. This makes it invaluable for processing ripped CDs, live recordings, or continuous mixes where all tracks are contained within one large file.

shnsplit is part of the shntool suite and acts as a user-friendly frontend specifically for the splitting task. It leverages shntool's backend capabilities to handle various audio formats, provided the necessary external encoders/decoders (like flac, wavpack, mac) are installed on the system. The output files can be generated in the same format as the input or converted to a different format, offering flexibility for audio management and archival.

CAVEATS

  • Dependency: shnsplit relies on the core shntool utility and external codecs (like flac, wavpack, mac) for handling various audio formats. Ensure these are installed for full functionality.
  • CUE Sheet Accuracy: The quality and accuracy of the splitting process are entirely dependent on the CUE sheet. Errors in the CUE file will result in incorrectly split tracks.
  • Disk Space: Splitting a large lossless audio file into multiple lossless files will require significant disk space, potentially double the size of the original file during the process.
  • ID3 Tags: While shnsplit uses CUE sheet metadata for filenames, it may not embed ID3 tags (or similar metadata) directly into the output audio files. Post-processing with a tag editor might be necessary.

COMMON USAGE EXAMPLE

To split a FLAC audio file named 'album.flac' using a CUE sheet named 'album.cue' into individual FLAC tracks in a 'tracks' subdirectory:

shnsplit -t album.cue -o flac -d tracks album.flac

OUTPUT FILENAME CONVENTIONS

By default, shnsplit generates output filenames based on the CUE sheet's track information, typically in the format of 'artist - album - track_number - track_title.ext', or similar, making the resulting files well-organized and easy to identify. The exact naming convention can sometimes be influenced by shntool's configuration or external tools.

HISTORY

shnsplit is an integral part of the shntool suite, a collection of utilities for manipulating lossless audio files, primarily developed by Jason Green. The shntool project began as a tool for Shorten (.shn) files but expanded to support other lossless formats like FLAC, APE, and WAV. shnsplit emerged as a dedicated frontend to simplify the common task of splitting a single audio stream into multiple tracks using CUE sheet information, becoming a staple for audiophiles managing their digital music collections.

SEE ALSO

shntool(1), cueconvert(1), flac(1), wavpack(1), mac(1)

Copied to clipboard