sobota, 1 grudnia 2012

Ubuntu 12.10: Rip audio to wav/mp3 directly from bin/cue image

Today I wanted to rip audio tracks from the image of a CD stored in cue format into a bunch of encoded audio files. Instead of burning the CD first and then ripping it into the desired format I decided to check if this can be done directly from the image file. Unfortunately I did not find a way to do it in one step but the described below two-step approach is not that bad at all.

Ripping audio from bin/cue into wav files

In order to do that you need to install bchunk utility (available in the standard repo) as in the example below:

$ sudo apt-get install bchunk
[sudo] password for krychu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  daemon
Use 'apt-get autoremove' to remove it.
The following NEW packages will be installed:
  bchunk
0 upgraded, 1 newly installed, 0 to remove and 24 not upgraded.
Need to get 13.1 kB of archives.
After this operation, 59.4 kB of additional disk space will be used.
Get:1 http://ubuntu.task.gda.pl/ubuntu/ quantal/universe bchunk amd64 1.2.0-12 [13.1 kB]
Fetched 13.1 kB in 8s (1,468 B/s)
Selecting previously unselected package bchunk.
(Reading database ... 548740 files and directories currently installed.)
Unpacking bchunk (from .../bchunk_1.2.0-12_amd64.deb) ...
Processing triggers for man-db ...
Setting up bchunk (1.2.0-12) ...


Afterwards you are ready to rip the audio files from the bin/cue. Please check the command below for reference:

$ bchunk -w Audio\ Disc.bin Audio\ Disc.cue audio
binchunker for Unix, version 1.2.0 by Heikki Hannikainen
Created with the kind help of Bob Marietta ,
partly based on his Pascal (Delphi) implementation.
Support for MODE2/2352 ISO tracks thanks to input from
Godmar Back , Colas Nahaboo
and Matthew Green .
Released under the GNU GPL, version 2 or later (at your option).

Reading the CUE file:

Track  1: AUDIO         01 00:00:00
Track  2: AUDIO         01 03:13:72
Track  3: AUDIO         01 07:05:72
Track  4: AUDIO         01 10:41:25
Track  5: AUDIO         01 14:47:30
Track  6: AUDIO         01 17:57:65
Track  7: AUDIO         01 20:56:54
Track  8: AUDIO         01 24:29:40
Track  9: AUDIO         01 28:07:22
Track 10: AUDIO         01 31:07:67
Track 11: AUDIO         01 33:39:47
Track 12: AUDIO         01 37:18:62

Writing tracks:

 1: audio01.wav   32/32   MB  [********************] 100 %
 2: audio02.wav   39/39   MB  [********************] 100 %
 3: audio03.wav   36/36   MB  [********************] 100 %
 4: audio04.wav   41/41   MB  [********************] 100 %
 5: audio05.wav   32/32   MB  [********************] 100 %
 6: audio06.wav   30/30   MB  [********************] 100 %
 7: audio07.wav   35/35   MB  [********************] 100 %
 8: audio08.wav   36/36   MB  [********************] 100 %
 9: audio09.wav   30/30   MB  [********************] 100 %
10: audio10.wav   25/25   MB  [********************] 100 %
11: audio11.wav   36/36   MB  [********************] 100 %
12: audio12.wav   18/18   MB  [********************] 100 %
$

Ok, now you have the audio tracks in the wav file format. in the next section you can find how to encode it into your preferred format (e.g. mp3).

Converting wav files to mp3

There are few utilities allowing to encode the wav file into mp3 available on linux. I used soundconverter, simple GUI tool, downloadable from the repo.


$ sudo apt-get install soundconverter
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  daemon
Use 'apt-get autoremove' to remove it.
The following packages will be upgraded:
  soundconverter
1 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
1 not fully installed or removed.
Need to get 0 B/138 kB of archives.
After this operation, 1,029 kB of additional disk space will be used.
(Reading database ... 548746 files and directories currently installed.)
Preparing to replace soundconverter 2.0.1-1 (using .../soundconverter_2.0.1-1_all.deb) ...
Unpacking replacement soundconverter ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for man-db ...
Setting up soundconverter (2.0.1-1) ...
$

Afterwards you can start it from command line (soundconverter) or main menu and encode the wav files into desired format (mp3, ogg etc.) as presented on the figure below:

Figure 1 Soundconverter GUI - converting wav files into mp3