Grimoire-
Command
.es

GNU+Linux command memo

Rip music CD to MP3 or FLAC

Copier un CD de musique en MP3 ou Flac

$ cdparanoia -d /dev/hda -B (1)

$ lame --vbr-new --preset extreme a_file.wav a_file.mp3 (2)
$ for x in `ls *.mp3`; do lame --vbr-new --preset extreme $x "`basename ${x} .wav`.mp3"; done; (3)

$ find . *.wav -print0 | xargs -0 -n 1 -P $((`nproc` / 2)) -I {} lame --vbr-new --preset extreme {} {}.mp3 (4)
$ rename 's/\.wav\.mp3$/\.mp3/' *.mp3 (5)

$ flac --replay-gain --best *.wav (6)
$ find . *.wav -print0 | xargs -0 -n 1 -P `nproc` -I {} flac --replay-gain --best "{}" (7)
1 CD → *.WAV
2 WAV → MP3
3 *.WAV → MP3 : See Find text in selected files for --print0 / -0 options ; backticks call a sub-command ; basename isolate main part of name from extension
4 *.WAV → MP3 in parallel : $(()) for math operations ; backticks nproc for CPU number
5 rename files in a second time
6 *.WAV → FLAC
7 *.WAV → FLAC in parallel