LinuxCommandLibrary

shntool-split

Split large audio files into tracks

TLDR

View documentation for the original command

$ tldr shnsplit
copy

SYNOPSIS

shntool split [GLOBAL_OPTIONS] [SPLIT_OPTIONS] AUDIO_FILES...

PARAMETERS

-f CUESHEET, --cue-file=CUESHEET
    Specifies the CUE sheet file to use for splitting. This option is often crucial for proper operation.

-o FORMAT, --output-format=FORMAT
    Sets the output audio format for the split tracks (e.g., flac, ape, wav, wv, tta).

-t TEMPLATE, --output-template=TEMPLATE
    Defines the naming convention for the output audio files. Common placeholders include %n (track number), %a (artist), %t (title), %l (album).

-A, --tag-audio
    Enables tagging of the output audio files with metadata extracted from the CUE sheet.

-s, --skip-existing
    Prevents overwriting existing output files; files that already exist are skipped.

-O, --overwrite
    Forces overwriting of existing output files with the new split tracks.

-D, --delete-source
    Deletes the original source audio file after successful splitting. Use with extreme caution!

-c, --cue-track-gap
    Treats CUE sheet 'track gap' information as actual audio data during splitting.

-n, --cue-no-track-gap
    Treats CUE sheet 'track gap' as silence, effectively ignoring its duration in audio calculations.

--cue-offset=OFFSET
    Applies a global time offset (e.g., +0.1s or -50ms) to all split points in the CUE sheet.

-q, --quiet
    Suppresses most standard output messages, useful for scripting.

-h, --help
    Displays help information for the split mode.

DESCRIPTION

The shntool-split command is a specialized mode within the versatile shntool utility, designed primarily to break down a single, large audio file (often a lossless CD image, like FLAC or APE) into individual tracks. This process is typically driven by a CUE sheet, which provides precise timing information for track boundaries, along with metadata such as track titles, artists, and album details.

It supports a wide array of lossless audio formats by leveraging external encoders and decoders (e.g., FLAC, APE, WavPack, TTA). shntool-split reads the CUE sheet, determines the exact start and end points for each track, and then extracts these segments, saving them as separate audio files. A key feature is its ability to tag these newly created track files automatically using the information embedded in the CUE sheet, making them easily manageable and playable as individual songs.

CAVEATS

shntool-split relies heavily on the accuracy and correctness of the provided CUE sheet. Malformed or incorrect CUE sheets can lead to improper splits or errors. It also depends on external audio tools (like flac, ape, wvunpack, etc.) being installed and accessible in the system's PATH. Users should exercise extreme caution when using the --delete-source option, as it permanently removes the original large audio file.

TYPICAL USAGE EXAMPLE

A common use case involves splitting a single FLAC file using a corresponding CUE sheet and outputting individual FLAC tracks with custom filenames:
shntool split -f my_album.cue -o flac -t '%n - %a - %t' my_album.flac

CUE SHEET IMPORTANCE

The CUE sheet is the heart of the splitting process. Ensure it accurately reflects the audio content's structure, including correct track timings and metadata, for optimal results. Errors in the CUE sheet directly translate to errors in the split files or their tags.

HISTORY

shntool, including its split mode, has been a staple in the open-source audio community for many years, providing robust command-line capabilities for handling lossless audio files. Its development arose from the need for a versatile, scriptable tool to process high-fidelity audio, especially for tasks like splitting ripped CD images and converting between lossless formats, without relying on graphical user interfaces. It continues to be maintained as a critical utility for audiophiles and archival purposes on Linux and Unix-like systems.

SEE ALSO

shntool(1), cuetag(1), flac(1), wavpack(1), ape(1)

Copied to clipboard