Saturday, July 12, 2008

Split lossless audio (ape, flac, wv, wav) by cue file in Ubuntu

source:

http://aidanjm.wordpress.com/2007/02/15/split-lossless-audio-ape-flac-wv-wav-by-cue-file/

[only convert without splitting here ]


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). To install cuetools and shntool in Ubuntu/ Kubuntu, open a terminal window and enter the following:

sudo aptitude install cuetools shntool

You will also need software for your prefered lossless audio format. For Monkey’s Audio you need to install “mac” - see here for details. For FLAC and WavPack formats you need to install “flac” and “wavpack” respectively:

sudo aptitude install flac wavpack

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

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”.

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

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

Note: If you are running flac version 1.1.4 or higher then you may need to make some small changes to the cuetag script before it will work correctly with flac files. Open the cuetag script (for Ubuntu installations it will be located at /usr/bin/cuetag) in a text editor and make these two changes: 1) search for the text “remove-vc-all” and replace it with “remove-all-tags”. 2) search for the “import-vc-from” and replace with “import-tags-from”.


Also see:

http://aidanjm.wordpress.com/2007/01/26/using-monkeys-audio-ape-files-in-ubuntu/


There you see you can convert image.ape to image.flac using

shnconv -o flac image.ape

Or an alternative to using shntool is to work via the mac and flac programs directly; to convert a monkey’s audio file to flac:

mac sample.ape sample.wav -d
flac -o sample.flac sample.wav
======================
Addition
What I usually do is batch processing to convert them to flac using pacpl audio conversion library:

> cd ~/yuckyapes
> pacpl -r -o ape -t flac *
.
. Test!
.
> find . -name '*.cue' -exec sed -i 's/\.ape/\.flac/' {} \;
> find . -name '*.ape' -exec rm {} \;

courtesy:Tri
=======================
first step: move in terminal to the folder where the ape file is,
2: convert image.ape to image.flac;
3: test the flac file;
4, rename image.ape to image.flac in the cuesheet;
5: remove the ape file.

A tutorial to install and use pacplin Ubuntu:
http://ubuntuforums.org/showthread.php?t=712064

1 comment:

Unknown said...

I use Avdshare Audio Converter to split ape, flac, mp3, wav, m4a, dts by cue

Here is the easy guide https://www.avdshare.com/flac-cue-splitter-for-mac-windows

Blog Archive