LDP/LDP/howto/docbook/MP3-CD-Burning.sgml

258 lines
9.8 KiB
Plaintext
Raw Normal View History

2001-05-29 16:24:07 +00:00
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
<article>
<artheader>
<title>Linux MP3 CD Burning mini-HOWTO</title>
<author>
<firstname>Greg</firstname>
<surname>Wierzchowski</surname>
<affiliation>
<address><email>greg.wierzchowski@usa.net</email></address>
</affiliation>
</author>
<pubdate>2001-05-29</pubdate>
<abstract>
<para>A complete recipe for creating audio CDs from MP3 files.</para>
</abstract>
<revhistory>
2001-09-03 16:16:08 +00:00
<revision>
<revnumber>1.3</revnumber>
<date>2001-09-02</date>
<authorinitials>GW</authorinitials>
<revremark>Added another example of decoding MP3 files with lame.</revremark>
</revision>
2001-07-14 01:09:06 +00:00
<revision>
<revnumber>1.2</revnumber>
<date>2001-07-12</date>
<authorinitials>GW</authorinitials>
<revremark>Minor layout changes; Added Translations subsection into Credits.</revremark>
</revision>
2001-07-02 14:44:29 +00:00
<revision>
<revnumber>1.1</revnumber>
<date>2001-06-12</date>
<authorinitials>GW</authorinitials>
<revremark>Minor cleanup; Regexp fix for MP3 to WAV name conversion example.</revremark>
</revision>
2001-05-29 16:24:07 +00:00
<revision>
<revnumber>1.0</revnumber>
<date>2001-05-29</date>
<authorinitials>GW</authorinitials>
<revremark>Initial Release.</revremark>
</revision>
</revhistory>
2001-09-03 16:16:08 +00:00
<keywordset>
<keyword>
MP3
</keyword>
<keyword>
CD
</keyword>
<keyword>
audio
</keyword>
<keyword>
recording
</keyword>
<keyword>
burning
</keyword>
<keyword>
WAV
</keyword>
<keyword>
music
</keyword>
</keywordset>
2001-05-29 16:24:07 +00:00
</artheader>
2001-07-14 01:09:06 +00:00
<section id="intro"><title>Introduction</title>
2001-05-29 16:24:07 +00:00
<para>
This mini-HOWTO was created because of my experience with burning music CDs
and lack of some specific information about sound normalization on the
Internet. I usually burn music CDs as a mix - different songs from different
sources.Very often volume level between songs varies greatly. This is the
first obstacle. Second, many of the files on the Internet are not
CD-compatible (16 bit, stereo, 44.1 kHz) and have to be converted. There are
many programs to burn music CDs from MP3 files, and many of them do the
conversion transparently. But I haven't seen a single tool that also
normalizes the volume, so that's why I worked out my own CD-burning recipe.
</para>
<para>
I'm assuming you wish to burn a CD with the collection of songs you obtained
from different sources, all varying quality, but you want to get the
best-sounding CD possible. This mini-HOWTO outlines the steps that may
help you.
</para>
2001-07-14 01:09:06 +00:00
<section id="copyright"><title>Copyright and License</title>
2001-05-29 16:24:07 +00:00
<para>This document is copyright 2001 by Greg Wierzchowski and is released under
the terms of the GNU Free Documentation License, which is hereby incorporated
by reference. Send feedback to
<ulink url="mailto:greg.wierzchowski@usa.net"><citetitle>greg.wierzchowski@usa.net</citetitle></ulink>.
</para>
2001-07-14 01:09:06 +00:00
</section>
</section>
2001-05-29 16:24:07 +00:00
2001-07-14 01:09:06 +00:00
<section id="prepare"><title>Preparing the Tracks</title>
2001-05-29 16:24:07 +00:00
<para>
<note><title>Note</title><para>All commands assume bash shell</para></note>
</para>
<orderedlist>
<listitem><para>Collect all MP3 files in one directory. </para></listitem>
<listitem><para>If any filenames contain spaces, first convert them to underscores: </para>
<programlisting>
for i in *.mp3; do mv "$i" `echo $i | tr ' ' '_'`; done </programlisting>
</listitem>
<listitem><para>Convert them to WAV with the command: </para>
<programlisting>
for i in *.mp3; do mpg123 -w `basename $i .mp3`.wav $i; done </programlisting>
<para><citetitle>Mpg123</citetitle> should be present in any Linux
distribution, but if you don't have it, get it at
<ulink url="http://www.mpg123.de/">http://www.mpg123.de/</ulink>.
2001-07-14 01:09:06 +00:00
</para><para><emphasis>NOTE</emphasis> I noticed that with some MP3 files mpg123 output was distorted.
2001-05-29 16:24:07 +00:00
At first I thought that MP3's were bad, but then I checked with another
player and they sounded OK. So I searched for another MP3 player that
could write WAV files to disk, and found this one: <citetitle>MAD mp3 decoder</citetitle> at
<ulink url="http://www.mars.org/home/rob/proj/mpeg/">http://www.mars.org/home/rob/proj/mpeg/</ulink>.
With <citetitle>madplayer</citetitle>, the command line is: </para>
<programlisting>
for i in *.mp3; do madplay -o `basename $i .mp3`.wav $i; done </programlisting>
<para>
2001-09-03 16:16:08 +00:00
There is yet another way to do the conversion. Some MP3 files apparently give both <command>mpg123</command> and
<command>madplay</command> trouble with decoding. The <command>lame</command> encoder, which has a decoding mode, seems
to handle difficult cases very well (<command>lame</command> can be found at <ulink url="http://www.mp3dev.org/mp3/">http://www.mp3dev.org/mp3/</ulink>) :
</para>
<programlisting>
for i in *.mp3; do lame --decode $i `basename $i .mp3`.wav; done
</programlisting>
<para>
2001-05-29 16:24:07 +00:00
<emphasis>NOTE:</emphasis> The <command>`basename $i .mp3`.wav</command> command
replaces MP3 extensions with WAV. There are 101 ways to do that, here's
2001-07-02 14:44:29 +00:00
the alternative: <command>`echo "$1" | sed 's/\.mp3$/.wav/'`</command>
2001-05-29 16:24:07 +00:00
</para></listitem>
<listitem><para>Run &quot;<command>file *.wav</command>&quot; and check the
output for any files different from 16 bit, stereo 44100 Hz.</para></listitem>
<listitem><para>If there are files with different characteristics, convert them to the
above specs. For example, to convert file track01.wav to obtain sample
rate 44.1 kHz, you could use: </para>
<programlisting>
sox track01.wav -r 44100 track01-new.wav resample</programlisting>
<para><citetitle>Sox</citetitle> is so popular, that it's probably installed
by default with any Linux distribution, and can be obtained from
<ulink url="http://www.spies.com/Sox/">http://www.spies.com/Sox/</ulink>.
However, the command-line options are somewhat cryptic for the casual
user (me). Look at
<ulink url="http://www.spies.com/Sox/sox.tips.html">http://www.spies.com/Sox/sox.tips.html</ulink>
for some tips on usage.
</para></listitem>
<listitem><para>Normalize your WAV files, to avoid drastic differences in volume
2001-07-02 14:44:29 +00:00
levels. I use a program by Chris Vaill (<email>cvaill@cs.columbia.edu</email>), called
2001-05-29 16:24:07 +00:00
<command>normalize</command> - it can be obtained from
<ulink url="http://www.cs.columbia.edu/~cvaill/normalize/">http://www.cs.columbia.edu/~cvaill/normalize/</ulink>
</para>
<para>
I use the following
syntax (-m is for mix mode, where all files should be as loud as
possible):</para>
<programlisting>
normalize -m *.wav</programlisting>
</listitem>
</orderedlist>
2001-07-14 01:09:06 +00:00
</section>
2001-05-29 16:24:07 +00:00
2001-07-14 01:09:06 +00:00
<section id="burning"><title>Burning Your CD</title>
2001-05-29 16:24:07 +00:00
<para>
There are many programs to create CDs from WAV files. I use <command>cdrecord</command> for
command-line burning and <command>XCDROAST</command> for gui. For <command>cdrecord</command>,
you have to know
what SCSI device your CD-writer is. If you're using ATAPI writer, use SCSI
emulation (kernel module ide-scsi). Let's assume, that your ATAPI cdwriter
is on the second IDE bus as a master. Thus, it will have <filename>/dev/hdc</filename> device
file. To instruct the kernel that you want to treat it as a SCSI device, add
the following line to <filename>/etc/lilo.conf</filename>: </para>
<programlisting>
append=" hdc=ide-scsi"
</programlisting>
<para>
Also, if your kernel doesn't automatically load ide-scsi module, add
2001-07-02 14:44:29 +00:00
<command>insmod ide-scsi</command> into your <filename>rc.local</filename>
2001-05-29 16:24:07 +00:00
(or equivalent) file. Once you have our CD-writer recognized as a
2001-07-02 14:44:29 +00:00
SCSI device, run <command>cdrecord --scanbus</command> to
2001-05-29 16:24:07 +00:00
find out what's the "dev" parameter to cdrecord. On my system, the
output looks like the following: </para>
<programlisting>
scsibus1:
1,0,0 100) 'IOMEGA ' 'ZIP 250 ' '51.G' Removable Disk
1,1,0 101) 'HP ' 'CD-Writer+ 7100 ' '3.01' Removable CD-ROM
</programlisting>
<para>
2001-07-14 01:09:06 +00:00
So, the <command>cdrecord</command> command line will contain <command>dev=1,1,0</command> to specify the
2001-05-29 16:24:07 +00:00
device. Here is the complete command on my system: </para>
<programlisting>
cdrecord dev=1,1,0 -eject speed=2 -pad -audio *.wav
</programlisting>
2001-07-14 01:09:06 +00:00
<note><title>NOTE</title><para> The -pad argument is neccessary,
2001-05-29 16:24:07 +00:00
because all audio tracks on the CD must be adjusted for the proper
data length, which is not always the case with mp3 files. </para></note>
2001-07-14 01:09:06 +00:00
</section>
2001-05-29 16:24:07 +00:00
2001-07-14 01:09:06 +00:00
<section id="credits"><title>Credits</title>
2001-07-02 14:44:29 +00:00
<para>
2001-07-14 01:09:06 +00:00
Special thanks to all the people who contribute to the Linux community and who made this HOWTO possible.
</para>
<section id="translations"><title>Translations</title>
2001-07-02 14:44:29 +00:00
<itemizedlist>
2001-07-14 01:09:06 +00:00
<listitem>
<para>
Im Eunjea - Translated this document to Korean, URL is <ulink url="http://kltp.kldp.org/eunjea/mp3_burning/">http://kltp.kldp.org/eunjea/mp3_burning/</ulink>.
2001-07-02 14:44:29 +00:00
</para>
2001-07-14 01:09:06 +00:00
</listitem>
<listitem>
<para>
Mendel L Chan - Translated this document to Chinese, URL is <ulink url="http://www.linux.org.tw/CLDP/mini/MP3-CD-Burning/">http://www.linux.org.tw/CLDP/mini/MP3-CD-Burning/</ulink>.
</para>
</listitem>
</itemizedlist>
</section>
<section id="othercredits"><title>Other Credits</title>
<itemizedlist>
<listitem>
<para> Greg Ferguson - Initially converted this document from HTML to SGML.
</para></listitem>
<listitem>
<para> Rob Russell - Corrected my name conversion example.
</para></listitem>
<listitem>
<para> Terry Davis - Suggested submitting my HOWTO to linuxdoc.
</para></listitem>
<listitem>
2001-09-03 16:16:08 +00:00
<para>Chris Vaill - Created <command>normalize</command> program.
</para></listitem>
<listitem>
<para> Jamie Kellogg - Submitted a solution to decode with <command>lame</command> for troublesome files.
2001-07-14 01:09:06 +00:00
</para></listitem>
</itemizedlist>
</section>
</section>
2001-05-29 16:24:07 +00:00
</article>