⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sound-mp3.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>MP3 Audio</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="Multimedia" href="multimedia.html" /><link rel="PREVIOUS" title="Setting Up the Sound Card" href="sound-setup.html" /><link rel="NEXT" title="Video Playback" href="video-playback.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="sound-setup.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 7 Multimedia</td><td width="10%" align="right" valign="bottom"><a href="video-playback.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="SOUND-MP3" name="SOUND-MP3">7.3 MP3 Audio</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Contributed by</span> Chern Lee.</i> <p>MP3 (MPEG Layer 3 Audio) accomplishes near CD-quality sound, leaving no reason to letyour FreeBSD workstation fall short of its offerings.</p><div class="SECT2"><h2 class="SECT2"><a id="MP3-PLAYERS" name="MP3-PLAYERS">7.3.1 MP3 Players</a></h2><p>By far, the most popular <b class="APPLICATION"><spanclass="TRADEMARK">XFree86</span>&#8482;</b> MP3 player is <b class="APPLICATION">XMMS</b>(X Multimedia System). <b class="APPLICATION">Winamp</b> skins can be used with <bclass="APPLICATION">XMMS</b> since the GUI is almost identical to that of Nullsoft's <bclass="APPLICATION">Winamp</b>. <b class="APPLICATION">XMMS</b> also has native plug-insupport.</p><p><b class="APPLICATION">XMMS</b> can be installed from the <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/multimedia/xmms/pkg-descr"><ttclass="FILENAME">multimedia/xmms</tt></a> port or package.</p><p><b class="APPLICATION">XMMS'</b> interface is intuitive, with a playlist, graphicequalizer, and more. Those familiar with <b class="APPLICATION">Winamp</b> will find <bclass="APPLICATION">XMMS</b> simple to use.</p><p>The <a href="http://www.FreeBSD.org/cgi/url.cgi?ports/audio/mpg123/pkg-descr"><ttclass="FILENAME">audio/mpg123</tt></a> port is an alternative, command-line MP3player.</p><p><b class="APPLICATION">mpg123</b> can be run by specifying the sound device and theMP3 file on the command line, as shown below:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">mpg123 -a <varclass="REPLACEABLE">/dev/dsp1.0</var> Foobar-GreatestHits.mp3</kbd>High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2 and 3.Version 0.59r (1999/Jun/15). Written and copyrights by Michael Hipp.Uses code from various people. See 'README' for more!THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!Playing MPEG stream from Foobar-GreatestHits.mp3 ...MPEG 1.0 layer III, 128 kbit/s, 44100 Hz joint-stereo</pre><p><var class="LITERAL">/dev/dsp1.0</var> should be replaced with the <ttclass="DEVICENAME">dsp</tt> device entry on your system.</p></div><div class="SECT2"><h2 class="SECT2"><a id="RIP-CD" name="RIP-CD">7.3.2 Ripping CD Audio Tracks</a></h2><p>Before encoding a CD or CD track to MP3, the audio data on the CD must be ripped ontothe hard drive. This is done by copying the raw CDDA (CD Digital Audio) data to WAVfiles.</p><p>The <tt class="COMMAND">cdda2wav</tt> tool, which is a part of the <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/sysutils/cdrtools/pkg-descr"><ttclass="FILENAME">sysutils/cdrtools</tt></a> suite, is used for ripping audio informationfrom CDs and the information associated with them.</p><p>With the audio CD in the drive, the following command can be issued (as <ttclass="USERNAME">root</tt>) to rip an entire CD into individual (per track) WAVfiles:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cdda2wav -D <varclass="REPLACEABLE">0,1,0</var> -B</kbd></pre><p><b class="APPLICATION">cdda2wav</b> will support ATAPI (IDE) CDROM drives. To rip froman IDE drive, specify the device name in place of the SCSI unit numbers. For example, torip track 7 from an IDE drive:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cdda2wav -D <varclass="REPLACEABLE">/dev/acd0a</var> -t 7</kbd></pre><p>The <var class="OPTION">-D <var class="REPLACEABLE">0,1,0</var></var> indicates theSCSI device <tt class="DEVICENAME">0,1,0</tt>, which corresponds to the output of <ttclass="COMMAND">cdrecord -scanbus</tt>.</p><p>To rip individual tracks, make use of the <var class="OPTION">-t</var> option asshown:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cdda2wav -D <varclass="REPLACEABLE">0,1,0</var> -t 7</kbd></pre><p>This example rips track seven of the audio CDROM. To rip a range of tracks, forexample, track one to seven, specify a range:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cdda2wav -D <varclass="REPLACEABLE">0,1,0</var> -t 1+7</kbd></pre><p>The utility <a href="http://www.FreeBSD.org/cgi/man.cgi?query=dd&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">dd</span>(1)</span></a> can also be usedto extract audio tracks on ATAPI drives, read <ahref="creating-cds.html#DUPLICATING-AUDIOCDS">Section 16.6.5</a> for more information onthat possibility.</p></div><div class="SECT2"><h2 class="SECT2"><a id="MP3-ENCODING" name="MP3-ENCODING">7.3.3 Encoding MP3s</a></h2><p>Nowadays, the mp3 encoder of choice is <b class="APPLICATION">lame</b>. <bclass="APPLICATION">Lame</b> can be found at <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/audio/lame/pkg-descr"><ttclass="FILENAME">audio/lame</tt></a> in the ports tree.</p><p>Using the ripped WAV files, the following command will convert <ttclass="FILENAME">audio01.wav</tt> to <tt class="FILENAME">audio01.mp3</tt>:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">lame -h -b <varclass="REPLACEABLE">128</var> \--tt "<var class="REPLACEABLE">Foo Song Title</var>" \--ta "<var class="REPLACEABLE">FooBar Artist</var>" \--tl "<var class="REPLACEABLE">FooBar Album</var>" \--ty "<var class="REPLACEABLE">2001</var>" \--tc "<var class="REPLACEABLE">Ripped and encoded by Foo</var>" \--tg "<var class="REPLACEABLE">Genre</var>" \<var class="REPLACEABLE">audio01.wav audio01.mp3</var></kbd></pre><p>128&nbsp;kbits seems to be the standard MP3 bitrate in use. Many enjoy the higherquality 160, or 192. The higher the bitrate, the more disk space the resulting MP3 willconsume--but the quality will be higher. The <var class="OPTION">-h</var> option turns onthe ``higher quality but a little slower'' mode. The options beginning with <varclass="OPTION">--t</var> indicate ID3 tags, which usually contain song information, to beembedded within the MP3 file. Additional encoding options can be found by consulting thelame man page.</p></div><div class="SECT2"><h2 class="SECT2"><a id="MP3-DECODING" name="MP3-DECODING">7.3.4 Decoding MP3s</a></h2><p>In order to burn an audio CD from MP3s, they must be converted to a non-compressed WAVformat. Both <b class="APPLICATION">XMMS</b> and <b class="APPLICATION">mpg123</b>support the output of MP3 to an uncompressed file format.</p><p>Writing to Disk in <b class="APPLICATION">XMMS</b>:</p><div class="PROCEDURE"><ol type="1"><li><p>Launch <b class="APPLICATION">XMMS</b>.</p></li><li><p>Right-click on the window to bring up the <b class="APPLICATION">XMMS</b> menu.</p></li><li><p>Select <var class="LITERAL">Preference</var> under <varclass="LITERAL">Options</var>.</p></li><li><p>Change the Output Plugin to ``Disk Writer Plugin''.</p></li><li><p>Press <var class="LITERAL">Configure</var>.</p></li><li><p>Enter (or choose browse) a directory to write the uncompressed files to.</p></li><li><p>Load the MP3 file into <b class="APPLICATION">XMMS</b> as usual, with volume at 100%and EQ settings turned off.</p></li><li><p>Press <var class="LITERAL">Play</var> -- <b class="APPLICATION">XMMS</b> will appearas if it is playing the MP3, but no music will be heard. It is actually playing the MP3to a file.</p></li><li><p>Be sure to set the default Output Plugin back to what it was before in order to listento MP3s again.</p></li></ol></div><p>Writing to stdout in <b class="APPLICATION">mpg123</b>:</p><div class="PROCEDURE"><ol type="1"><li><p>Run <tt class="COMMAND">mpg123 -s <var class="REPLACEABLE">audio01.mp3</var> &gt;audio01.pcm</tt></p></li></ol></div><p><b class="APPLICATION">XMMS</b> writes a file in the WAV format, while <bclass="APPLICATION">mpg123</b> converts the MP3 into raw PCM audio data. Both of theseformats can be used with <b class="APPLICATION">cdrecord</b> to create audio CDs. Youhave to use raw PCM with <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=burncd&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">burncd</span>(8)</span></a>. If you useWAV files, you will notice a small tick sound at the beginning of each track, this soundis the header of the WAV file. You can simply remove the header of a WAV file with theutility <b class="APPLICATION">SoX</b> (it can be installed from the <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/audio/sox/pkg-descr"><ttclass="FILENAME">audio/sox</tt></a> port or package):</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">sox -t wav -r 44100 -s -w -c 2 <varclass="REPLACEABLE">track.wav track.raw</var></kbd></pre><p>Read <a href="creating-cds.html">Section 16.6</a> for more information on using a CDburner in FreeBSD.</p></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="sound-setup.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="video-playback.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">Setting Up the Sound Card</td><td width="34%" align="center" valign="top"><a href="multimedia.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Video Playback</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -