Split flac/ape/wv/wav + cue sheet into separate tracks

Related tags

shell split flac cue-sheet
Overview

See unflac as a better replacement of this project.

split2flac

split2flac splits one big APE/FLAC/TTA/WV/WAV audio image (or a collection of such files, recursively) with CUE sheet into FLAC/M4A/MP3/OGG_VORBIS/OPUS/WAV tracks with tagging, renaming, charset conversion of cue sheet, album cover images. It also uses configuration file, so no need to pass a lot of arguments every time, only an input file. Should work in any POSIX-compliant shell.

NOTE: script is able to find cover image and cue sheet automatically (including internal ones).

Manual installation

  • place split2flac somewhere (/usr/bin or /usr/local/bin is fine)

  • create symbolic links to the same file like this:

    cd /usr/bin    # this is a directory where split2flac was installed
    ln -s split2flac split2mp3
    ln -s split2flac split2ogg
    ln -s split2flac split2opus
    ln -s split2flac split2m4a
    ln -s split2flac split2wav
    

Dependencies

  • Required:

    • shntool
    • cuetools
  • Optional:

    • flac (or better flake, which is much faster) to split from/into FLAC
    • faac and libmp4v2 to split into M4A
    • wavpack to split WV
    • mac to split APE
    • ttaenc to split TTA
    • imagemagick to convert/resize album cover images
    • iconv to convert CUE sheet from non-UTF8 charset
    • enca to automatically detect charset if it's not UTF8
    • lame and id3lib (or better mutagen for Unicode tags) to split into MP3
    • vorbis-tools to split into OGG VORBIS
    • opus-tools to split into OPUS
  • Replay Gain:

    • flac for FLAC Replay Gain support
    • aacgain to adjust gain in M4A
    • mp3gain for MP3
    • vorbisgain for OGG VORBIS gain adjustment

Support

Learn about Plan 9 (http://9p.io/wiki/plan9/Overview/index.html). It's awesome. Thank you.

Issues
  • Timing problems

    Timing problems

    Hi, I noticed that split2flac doesn't cut my files precisely. Usually I have a warning like: shnsplit: warning: rounding 4:42.050 (offset: 49753620) to nearest sector boundary (offset: 49754208)

    I omitted the usage of cuebreakpoints and this actually helped. Here is my patch against 114 version:

    --- /usr/bin/split2flac 2015-01-17 15:52:43.000000000 +1100 +++ split2flac 2015-01-17 15:51:18.321760070 +1100 @@ -503,10 +503,7 @@ esac

        # split to tracks
    
    •   # sed expression is a fix for "shnsplit: error: m:ss.ff format can only be used with CD-quality files"
      
    •   cuebreakpoints "${CUE}" 2>/dev/null | \
      
    •       sed 's/$/0/' | \
      
    •       shnsplit -O never -o "${ENC}" -d "${OUT}" -t "%n" "${FILE}"
      
    •   shnsplit -O never -f "${CUE}" -o "${ENC}" -d "${OUT}" -t "%n" "${FILE}"
      if [ $? -ne 0 ]; then
          emsg "Failed to split\n"
          return 1
      
    opened by plusInfinity 4
  • Copy over is not working

    Copy over is not working

    Although there is a cover.jpg in the working directory, the program reports the following message and the cover file is consequently not copied to the destination folder.

    Copying files:
    cp: cannot stat './[Cc]overs': No such file or directory
    cp: cannot stat './*.log': No such file or directory
    cp: cannot stat './*.txt': No such file or directory
    cp: cannot stat './*.jpg': No such file or directory
    cp: cannot stat './*.cbr': No such file or directory
    

    I'm running the following versions

    split2flac version: 122
    
    shntool 3.0.10
    flac 1.3.2
    -- Monkey's Audio Console Front End (v 3.99-u4-b5-s7) (c) Matthew T. Ashland --
    FAAC 1.29.9.2
    oggenc from vorbis-tools 1.4.0
    LAME 64bits version 3.100 (http://lame.sf.net)
    
    opened by oimaasi 2
  • Script cannot handle cue files with a single track

    Script cannot handle cue files with a single track

    I use split2flac for mass splitting of albums under a supervisor script, processing the tree one directory of albums at a time. There are a number of albums in the directory tree with only one track. They have a cue file like this:

    PERFORMER "someperformer"
    TITLE "somealbum"
    FILE "somealbum.flac" WAVE
      TRACK 01 AUDIO
        TITLE "sometrack"
        PERFORMER "someperformer"
        INDEX 01 00:00:00
    

    This causes the following message to appear when such an album is processed.

    shnsplit: error: no split points given -- nothing to do
    Failed to split
    Failed to split "/path/to/somealbum.flac"
    

    Afterwards the following message is printed and the process exits with status 3.

    1 file(s) failed to split (already split?):
    
    [filename]
    
    These files are also listed in split_failed.txt.
    

    This is rather problematic for me for two reasons: I have to convert said albums by hand afterwards, and because I use directory input, when my supervisor script sees a non-zero exit status it has to write off the entire directory as failed. Desired behavior would be to just skip the splitting stage and process the whole source file as a single track, using the metadata from track 01 for naming and tags.

    opened by tvdstaaij 2
  • Consider using tags for versioning

    Consider using tags for versioning

    This way, source can be linked directly rather than requiring a git pull.

    Thank you!

    opened by graysky2 1
  • Unofficial docker image

    Unofficial docker image

    Hi,

    Just wanted to let you know I've put together a simple docker image for split2flac including all dependencies.

    https://github.com/mikenye/docker-split2flac https://hub.docker.com/r/mikenye/split2flac/

    Thanks for your handy utility.

    Kind regards, Mike

    opened by mikenye 1
  • Support Link

    Support Link

    This script is life changing, please include a link to assist you in continued development of OSS tools, or tell us to donate to a project like EFF.

    Thank you hero.

    opened by storrgie 1
  • please don't delete an old tag

    please don't delete an old tag

    If you change the code, please do not delete the old tag. Just increment the version number in a new tag. Why? Folks packaging your code for a particular distro will likely be pulling the source tarball from your tagged versions and recording the checksum for said tarball.

    opened by graysky2 1
  • Bash brace expansion used

    Bash brace expansion used

    When copying files with $COPYMASKS, a bash brace expansion is done inside "eval". On Debian, /bin/sh defaults to dash and this expansion doesn't work. Changing the required shell to /bin/bash instead of /bin/sh makes copy feature work again (and the whole script works fine).

    Please, fix this expression to a plain sh compatible expr or change required script shell to /bin/bash.

    Thanks.

    opened by mbarchein 0
  • update year in copyright

    update year in copyright

    ...don't forgot to tag it :p

    opened by graysky2 0
  • Support rename flacs with Chinese characters

    Support rename flacs with Chinese characters

    Support rename flacs with Chinese characters

    opened by jiangzhouq 0
  • Support BSD sed and improvements to cuefile handling

    Support BSD sed and improvements to cuefile handling

    • Some sed commands require extended regular expressions for BSD sed variants.
    • Improve temporary CUE to be deleted always, even if errors occur. Also hides the warning when the file exists, since it is no longer static.
    opened by dmlemos 0
  • split2flac-bash-completion.sh: Syntax error

    split2flac-bash-completion.sh: Syntax error

    12: /etc/profile.d/split2flac-bash-completion.sh: Syntax error: "(" unexpected (expecting "fi")

    Ubuntu 18.04.2

    opened by mcardia 0
  • fix Copy Over

    fix Copy Over "cannot stat" error

    Force destination dir to be absolute, so as to avoid problems with wildcards in COPYMASKS Use a consistent method for escaping wildcard and filename substitution in COPYMASKS

    This fixes three issues:

    • wildcards in COPYMASKS are expanded correctly when testing for existence, but are not expanded at all in the copy command. Result: 'cannot stat' error message and nothing gets copied.
    • the copy command is executed for all items in COPYMASKS, even if they do not exist. Result: false 'cannot stat' error message.
    • in COPYMASKS you use a backslash escape for "*" wildcard, but no escape for "[" filename substitution.

    Example of error output, when there exists a directory called Covers, which fails to be copied, and there is nothing matching '*.log' but we still try to copy it - and fail.

    " Copying files: +> Covers cp: cannot stat 'MyDir/[Cc]overs': No such file or directory cp: cannot stat 'MyDir/*.log': No such file or directory "

    opened by kaributena 0
  • Try to detect charset with 'file' command

    Try to detect charset with 'file' command

    Try to auto detect charset before ask

    opened by jordiromera 0
  • opus is tagged with id3 tags, creating invalid files

    opus is tagged with id3 tags, creating invalid files

    Chrome (and maybe others) doesn't recognize opus files with id3 tags. Opus has its own tagging scheme that should be used instead. The "canonical" way to update tags in existing opus files seems to be through the mutagen python library.

    opened by pgeorgi 0
  • Save splitted files to same directory, where source file located

    Save splitted files to same directory, where source file located

    Hello. Is this possible? I don't want to create any subdirs, and don't want to save them to '.', just want to save them near cue files.

    Please help

    opened by UralZima 2
  • Check shntool and cuetools existance

    Check shntool and cuetools existance

    It's better to check cuetools/shntool tools existance to avoid cryptic shell errors, like this:

    /home/mvel/.local/bin/split2flac: line 431: [: 1: unary operator expected
    Failed to get number of tracks from CUE sheet.
    There may be an error in the sheet.
    /home/mvel/.local/bin/split2flac: line 123: printf: `N': invalid format character
    Running cueprint -n 1 -t /home/mvel/.local/bin/split2flac: line 443: cueprint: command not found
    
    opened by dichlofos 3
  • Adjust Gain flag produces error

    Adjust Gain flag produces error

    uname: 3.14.4-1-ARCH split2flac -v: "split2flac version: 114 shntool 3.0.10 flac 1.3.0 --- Monkey's Audio Console Front End (v 3.99) (c) Matthew T. Ashland --- FAAC 1.28 LAME 64bits version 3.99.5 (http://lame.sf.net)"

    set flag -g to adjust gain. error message produced during output "Adjusting gain /usr/bin/split2flac: line 650: [: argument expected"

    script did not terminate abnormally

    opened by scottfurry 0
Owner
Sigrid Solveig Haflínudóttir
Some kind of developer? She/they. I do not really use Github anymore.
Sigrid Solveig Haflínudóttir
Bule-ish CD ripper

cyanrip Fully featured CD ripping program able to take out most of the tedium. Fully accurate, has advanced features most rippers don't, yet has no bl

Lynne 57 Jun 30, 2021
Music typeset with the Lilypond system

Intro (from long ago) This repo contains sheet music typeset with the Lilypond typesetter. The music chosen is in favour of cello music (mostly chambe

Enthusiastic about  the Cello 95 Sep 24, 2021
Full-featured CD/DVD/Blu-ray burning and ripping application

K3b Version 18.04.0 Thanx for downloading K3b - The CD Kreator These are the features so far: - the most userfriendly interface ever ;-) - thema

KDE GitHub Mirror 73 Sep 18, 2021
🎚️ Open Source Audio Matching and Mastering

Matching + Mastering = ❤️ Matchering 2.0 is a novel Containerized Web Application and Python Library for audio matching and mastering. It follows a si

Sergey Grishakov 490 Sep 24, 2021
web based music sheet viewer (go, pdfjs) as a single binary

Digital Music Stand A simple cross-platform browser-based pdfjs-based viewer to display and search music sheets. A single binary including all assets.

Patrick Wieschollek 21 Aug 27, 2021
Javascript audio library for the modern web.

Description howler.js is an audio library for the modern web. It defaults to Web Audio API and falls back to HTML5 Audio. This makes working with audi

James Simpson 19k Sep 25, 2021
Python CD-DA ripper preferring accuracy over speed

Whipper Whipper is a Python 3 (3.6+) CD-DA ripper based on the morituri project (CDDA ripper for *nix systems aiming for accuracy over speed). It star

null 554 Sep 19, 2021
Collaborative Programmable Music

888 888 _ooooooooo._ 888 ,o888PP""""PP88

Overtone 5.2k Sep 24, 2021
The git repository of the advanced drum machine

Hydrogen drum machine Hydrogen is an advanced drum machine for GNU/Linux, Mac and Windows. It's main goal is to bring professional yet simple and intu

Hydrogen 702 Sep 15, 2021
The fre:ac audio converter project

fre:ac - free audio converter fre:ac is a free and open source audio converter. It supports audio CD ripping and tag editing and converts between vari

Robert Kausch 619 Sep 24, 2021
Fork of the original rubyripper from code.google.com/p/rubyripper + some bugs fixes

Historical note Introduction Secure rip method How to install MacOS Support FAQ Running all tests Historical note This is an unofficial fork of the or

null 91 Aug 11, 2021
Open source sheet music

The Mutopia Project The Mutopia Project offers sheet music based on editions in the public domain. All sheet music is written in LilyPond by volunteer

null 187 Sep 3, 2021
A Music programming language. Translates source code into MIDI. Includes a player. Supports MIDI-Karaoke. Includes a MIDI analyzer.

Get Started | Features | Screenshots | Programming | CLI | Contribute | License Midica is an interpreter for a Music Programming Language. It translat

Jan Trukenmüller 47 Sep 17, 2021
Automatic command-line mp3/ogg/flac file tagger and renamer

lltag is a frontend to tag (and rename) mp3/ogg/flac files automagically. See http://bgoglin.free.fr/lltag/ for details. lltag installation instruct

Brice Goglin 22 Jul 25, 2021
🎵 A simple, clean and cross-platform music player

Museeks A simple, clean and cross-platform music player. (museeks.io) Features Museeks aims to be a simple and easy to use music player with a clean U

Pierre de la Martinière 1.1k Sep 17, 2021
🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)

Verovio is a fast, portable and lightweight library for engraving Music Encoding Initiative (MEI) digital scores into SVG images. Verovio also contain

RISM Digital Center 426 Sep 22, 2021
Soundnode App is the Soundcloud for desktop. Built with Electron, Angular.js and Soundcloud API.

Soundnode App Soundnode App is an Open-Source project to support Soundcloud for desktop Mac, Windows, and Linux. It's built with Electron, Node.js, An

Soundnode App 4.8k Sep 23, 2021
Streaming music player that finds free music for you

Desktop music player focused on streaming from free sources Links Official website Mastodon Twitter Support channel (Matrix): #nuclear:matrix.org Disc

null 6.8k Sep 17, 2021