mkaudiocd

[Josh Wheeler]

Categories: projects

Make audio CD (CD-DA) from a variety of audio formats.

This python program was created for the purpose of burning standard “Red Book” audio CDs from m3u playlists.

When a computer is used that doesn’t have a CD burner, output to BIN/CUE can be chosen and the disc burned later.

Given an m3u playlist, mkaudiocd will:

Examples

Output BIN/CUE from playlist.m3u to the user’s home directory:

mkaudiocd /path/to/playlist.m3u -o ~/Music

Burn songs in playlist.m3u to audio cd

mkaudiocd playlist.m3u --burn

Output BIN/CUE of playlist.m3u to current directory using ~/Music/flac as a base directory

mkaudiocd playlist.m3u --dir ~/Music/flac -o .

Burn BIN/CUE to a disc using /dev/sr0

cdrdao write --device /dev/sr0 music.cue

Installation

Install the requirements for your distribution

Debian

sudo apt install ffmpeg normalize-audio shntool cdrdao

Fedora

Enable RPM Fusion for your system from https://rpmfusion.org/ and run the following to install all requirements:

sudo dnf install ffmpeg normalize shntool cdrdao

To install (or upgrade) mkaudiocd, clone the git repo (or download the zip and unzip) cd to the directory and install

sudo python setup.py install

Requirements

mkaudiocd requires the following tools to be on the system or users’ $PATH:

Usage

usage: mkaudiocd [-h] [-d DIRECTORY] [-n {mix,batch,all,none}] [-o OUTPUT]
[-b] [--dev DEV] [-V]
playlist

mkaudiocd - Copyright (C) 2017 Josh Wheeler. This program comes with
ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to
redistribute it under certain conditions. See
https://gitlab.com/mantlepro/mkaudiocd for details.

positional arguments:
playlist              m3u playlist

optional arguments:
-h, --help            show this help message and exit
-d DIRECTORY, --directory DIRECTORY
base directory for audio
-n {mix,batch,all,none}, --normalize {mix,batch,all,none}
mix (default): adjust track gain up or down to a
common average. batch: normalize gain to match the
quietest song. all: normalize to 0dB regardless of
average, none: skip the normalize process
-o OUTPUT, --output OUTPUT
output bin/cue
-b, --burn            burn cd
--device DEVICE       path to cdrecorder
-V, --version         show program's version number and exit

If playlist contains relative paths to music that can’t be found, add the directory using --directory

mkaudiocd --directory=/path/to/music playlist.m3u

By default, mkaudiocd will look in paths: $HOME/Music, current working directory, and the same path as m3u playlist as base directories.

The --output feature can be used to store a BIN/CUE to be burned later. This feature is helpful if your audio library is on a computer that does not have a CD burner but wish to transfer the BIN/CUE to a computer that does.

Arguments may be abbreviated e.g. --out for --output, --dir for --directory, etc.

Troubleshooting

In the event that the CD plays only static, byte order may need to be swapped.

Test byte order (big endian, little endian):

aplay -f S16_BE --rate=44100 -c 2 music.cdda
aplay -f S16_LE --rate=44100 -c 2 music.cdda

If music is heard using S16_BE, it’s ready to be burned to a cd

cdrdao write --device /dev/sr0 music.cue

If music is heard using S16_LE use --swap

cdrdao write --swap --device /dev/sr0 music.cue

Byte order can also be verified visually / numerically using cdrdao show-data file.cue.

cdrdao show-data file.cue
cdrdao show-data --swap file.cue

A correct output shows signed numbers ascending and descending. If numerical randomness is seen, the output will be noise.