Ripping a CD to MP3 in Linux command prompt

Posted by Andrew Denner on May 23, 2018 · 4 mins read

listening

More and more often computers don’t have CD drives. If you still have some “old fashioned” cds that you want to take with you on a trip, the linux shell can be a quick way to digitize them…

First off, if you don’t have the correct programs we will start there.

sudo apt-get install cdparanoia lame

then run the command cdparanoia -vsQ to make sure the disk and drive are working.

cdparanoia III release 10.2 (September 11, 2008)

Using cdda library version: 10.2
Using paranoia library version: 10.2
Checking /dev/cdrom for cdrom...
	Testing /dev/cdrom for SCSI/MMC interface
		SG_IO device: /dev/sr0

CDROM model sensed sensed: TSSTcorp CD/DVDW SH-S182D SB04 

Checking for SCSI emulation...
	Drive is ATAPI (using SG_IO host adaptor emulation)

Checking for MMC style command set...
	Drive is MMC style
	DMA scatter/gather table entries: 1
	table entry size: 131072 bytes
	maximum theoretical transfer: 55 sectors
	Setting default read size to 27 sectors (63504 bytes).

Verifying CDDA command set...
	Expected command set reads OK.

Attempting to set cdrom to full speed... 
	drive returned OK.

Table of contents (audio tracks only):
track        length               begin        copy pre ch
===========================================================
  1.    15485 [03:26.35]        0 [00:00.00]    no   no  2
  2.    20316 [04:30.66]    15485 [03:26.35]    no   no  2
  3.    23579 [05:14.29]    35801 [07:57.26]    no   no  2
  4.    17344 [03:51.19]    59380 [13:11.55]    no   no  2
  5.    13928 [03:05.53]    76724 [17:02.74]    no   no  2
  6.    14954 [03:19.29]    90652 [20:08.52]    no   no  2
  7.    18415 [04:05.40]   105606 [23:28.06]    no   no  2
  8.    13386 [02:58.36]   124021 [27:33.46]    no   no  2
  9.    17697 [03:55.72]   137407 [30:32.07]    no   no  2
 10.    22469 [04:59.44]   155104 [34:28.04]    no   no  2
 11.    16163 [03:35.38]   177573 [39:27.48]    no   no  2
 12.    15423 [03:25.48]   193736 [43:03.11]    no   no  2
 13.    18116 [04:01.41]   209159 [46:28.59]    no   no  2
 14.    20106 [04:28.06]   227275 [50:30.25]    no   no  2
 15.    18373 [04:04.73]   247381 [54:58.31]    no   no  2
 16.    26250 [05:50.00]   265754 [59:03.29]    no   no  2
 17.    15166 [03:22.16]   292004 [64:53.29]    no   no  2
 18.    18664 [04:08.64]   307170 [68:15.45]    no   no  2
TOTAL  325834 [72:24.34]    (audio only)

Then run cdparanoia -B to begin the rip (make sure you are in the folder you want to be in…

cdparanoia III release 10.2 (September 11, 2008)

 
Ripping from sector       0 (track  1 [0:00.00])
	  to sector  325833 (track 18 [4:08.63])

outputting to track01.cdda.wav

 (== PROGRESS == [                              | 015484 00 ] == :^D * ==)   

outputting to track02.cdda.wav

 (== PROGRESS == [                              | 035800 00 ] == :^D * ==)
.....
...
...
outputting to track18.cdda.wav

 (== PROGRESS == [                              | 325833 00 ] == :^D * ==)   

Done.

After this finishes you will need to convert over to a more compact format (optional) like mp3.

for t in track*.wav; do lame $t; done

the end result will look something like

LAME 3.99.5 64bits (http://lame.sf.net)
...
...
...
...
LAME 3.99.5 64bits (http://lame.sf.net)
Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz
Encoding track14.cdda.wav to track14.cdda.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (11x) 128 kbps qval=3
 Frame | CPU time/estim | REAL time/estim | play/CPU | ETA 
 14025/14025 (100%)| 0:05/ 0:05| 0:05/ 0:05| 61.562x| 0:00 
-------------------------------------------------------------------------------
 kbps MS % long switch short %
 128.0 100.0 87.2 6.4 6.4
Writing LAME Tag...done
ReplayGain: -2.1dB

Congratulations! (Credit: most of these directions were inspired from article)