红联Linux门户
Linux帮助

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

发布时间:2008-09-13 11:21:50来源:红联作者:Notalos
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” software). 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 (e.g., split-track001.flac, split-track002.flac, etc); you can specifying your own prefix via the “-n” option.

To see all the options for shntool split type “shntool split -h” or “shnsplit -h”.

Transferring tags (artist, title, etc) from cue file to audio files

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-track001.flac split-track002.flac split-track0032.flac split-track004.flac

This will transfer the tag data contained in “sample.cue” to the flac audio tracks “split-track001.flac” “split-track002.flac” “split-track003.flac” and “split-track004.flac”.

The above example can be streamlined as follows:

cuetag sample.cue `ls split-track*.flac`
文章评论

共有 0 条评论