2013-04-11

HOWTO: convert audio CD image (FLAC + CUE) to MP3 tracks in Linux

Imagine you've archived your favourite audio CD into FLAC/CUE pair format (or maybe you've purchased some album in that digital downloadable lossless audio format, who knows), and now you want to convert it to the standard MP3 files for playing that album in your good old digital music player.

Let the files be processed in Debian GNU/Linux environment (sample commands tested in Debian 7.0 "Wheezy", and should also work for all Debian-based distros, e. g. Ubuntu, Mint etc.; Bash shell is assumed to be installed & used by default).

First of all, you should install all the necessary tools: FLAC (for decoding FLAC to WAV), LAME (to convert WAV to MP3), cuetools (to parse the CUE sheet) and shntool (to cut the big WAV file into smaller tracks according to the CUE sheet breakpoints).
# apt-get install flac lame cuetools shntool
Then the conversion process itself begins.
$ flac -d MyMusic.flac
$ cuebreakpoints MyMusic.cue | shnsplit MyMusic.wav
$ rm MyMusic.wav
$ for file in split-track*.wav; do lame -V0 $file; done
$ rm split-track*.wav
The output files are by default MP3 VBR V0, 44.1 KHz, Joint Stereo; it should be decent for most situations.
After conversion, you can process split-track*.mp3 files with your favourite media tagger application.
Enjoy.

1 comment:

  1. Thank you. I found that you can skip a couple of steps by using shnsplit with these modifiers:

    $ shnsplit -f MyMusic.cue -t "%n %t" -o "cust ext=mp3 lame -V0 - %f" MyMusic.flac
    $ cuetag MyMusic.cue *.mp3

    ReplyDelete