If you have some music on your Linux system and want to burn it to an audio CD, it can be done via the command line. This will even work if you have a mixture of audio formats and file types.
Of course, it’s also possible to burn audio CDs within a desktop environment. But where’s the fun in that? In this tutorial, you’ll see the programs and commands necessary to burn an audio CD on Linux.
In this tutorial you will learn:
- How to normalize various music tracks
- How to use wodim to burn audio CD
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Software||wodim, ffmpeg, normalize-audio|
|Other||Privileged access to your Linux system as root or via the
|Conventions||# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
We’ll need a few different programs to burn an audio CD from the command line. They are wodim, ffmpeg, and normalize-audio. The last one is not strictly necessary, but is recommended to make your entire CD sound equal.
You can use the appropriate command below to install wodim, ffmpeg, and normalize-audio with your system’s package manager.
$ sudo apt install wodim ffmpeg normalize-audio
Normalize Audio Levels
If your music files are from various releases, it’s very likely that the volume settings on each track are different. This means that some songs may be louder than others, and you’ll be constantly reaching for the volume knob to fix the difference.
To make the volume uniform, we can use the
normalize-audio command. This program only works on .wav and .mp3 files. If you have some other format, like .ogg, then you should first convert the files .wav. Since .wav is a lossless format, your audio files will not lose quality.
- First, eliminate spaces in your file names by replacing the spaces with underscores.
$ for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done
- Then, convert all music files to .wav with the following command.
$ for i in $( ls ); do ffmpeg -i $i $i.wav; done
- Next, use the
normalize-audiocommand to equalize the volume across all your .wav files.
$ normalize-audio -m *.wav
The output should look something like this:
Computing levels... Lemuria_-_05_-_Le 100% done, ETA 00:00:00 (batch 100% done, ETA 00:00:00) Applying adjustment of 4.15dB to 03.Come_As_You_Are.mp3.wav... 03.Come_As_You_Ar 100% done, ETA 00:00:00 (batch 22% done, ETA 00:00:00) Applying adjustment of -0.91dB to 07_-_Crystal_Mountain.mp3.wav... 07_-_Crystal_Moun 100% done, ETA 00:00:00 (batch 52% done, ETA 00:00:01) Applying adjustment of -0.82dB to 09-We_Who_Are_Not_as_Others.mp3.wav... 09-We_Who_Are_Not 100% done, ETA 00:00:00 (batch 75% done, ETA 00:00:01) Applying adjustment of -1.37dB to Lemuria_-_05_-_Lemuria.ogg.wav... Lemuria_-_05_-_Le 100% done, ETA 00:00:00 (batch 100% done, ETA 00:00:00)
Your tracks should now have their volumes normalized, and we can move on to burning the tracks.
Burn Audio CD
Follow the steps below to burn your normalized .wav or .mp3 music tracks to CD. Before starting, make sure you have a blank CD-R disc inserted into your computer’s disc tray.
- The first step is to identify our CD/DVD burner block device file name with the
$ wodim --devices wodim: Overview of accessible drives (1 found) : ------------------------------------------------------------------------- 0 dev='/dev/scd0' rwrw-- : 'TSSTcorp' 'CD/DVDW SH-S183L' -------------------------------------------------------------------------
Take a note of the block device file path, which in this case is
- Next, use the following
wodimcommand to burn all audio .wav files to your CD.
$ wodim -v -nofix -eject dev='/dev/scd0' -audio -pad *.wav
- All done. Your music CD is ready to use. Please note that the
-nofixoption will instruct wodim to not close the CD disk session, which allows us to put more tracks on the disc if required. When you are done adding tracks and you wish to close the CD session, you can do it by using the
$ wodim -v -fix -eject dev='/dev/scd0'
In this tutorial, we learned how to burn an audio CD from the Linux command line. We also saw how to normalize the volume levels across various tracks, since media from different sources is likely to have different volume peaks. As you can see, burning an audio CD from the command line is not hard at all, and perhaps even easier than doing it in GUI.