8.3. MP3 ¥ª¡¼¥Ç¥£¥ª

´ó¹Æ: Chern Lee.

MP3 (MPEG Layer 3 Audio) ¤Ï CD ¤ËɤŨ¤¹¤ë²»¼Á¤Ç¥µ¥¦¥ó¥É¤òºÆÀ¸¤Ç¤­¤Þ¤¹¡£¤¢¤Ê¤¿¤Î FreeBSD ¥ï¡¼¥¯¥¹¥Æ¡¼¥·¥ç¥ó¤Ë¤³¤Î¥×¥ì¥¤¥ä¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤Ê¤¤Íýͳ¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¡£

8.3.1. MP3 ¥×¥ì¥¤¥ä

XMMS (X Multimedia System) ¤Ï ¤È¤Æ¤â¿Íµ¤¤Î¤¢¤ë X11 ¥Ù¡¼¥¹¤Î MP3 ¥×¥ì¥¤¥ä¤Ç¤¹¡£ XMMS ¤Î¥°¥é¥Õ¥£¥«¥ë¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ï Nullsoft ¤Î Winamp ¤È¤Û¤È¤ó¤ÉƱ°ì¤Ê¤Î¤Ç¡¢Winamp ¤Î¥¹¥­¥ó¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ XMMS ¤Ï¥Í¥¤¥Æ¥£¥Ö¥×¥é¥°¥¤¥ó¤Ë¤âÂбþ¤·¤Æ¤¤¤Þ¤¹¡£

XMMS ¤Ï multimedia/xmms ¤Î port ¤Þ¤¿¤Ï package ¤«¤é¥¤¥ó¥¹¥È¡¼¥ë¤Ç¤­¤Þ¤¹¡£

XMMS ¤Î¥×¥ì¥¤¥ê¥¹¥È¡¢¥°¥é¥Õ¥£¥Ã¥¯¥¤¥³¥é¥¤¥¶¤½¤·¤Æ¤½¤Î¾¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ï ľ´¶Åª¤Ç¤¹¡£ Winamp ¤ò»È¤¤¤Ê¤ì¤Æ¤¤¤ë¿Í¤Ï ´Êñ¤Ë XMMS ¤ò»È¤¨¤ë¤Ç¤·¤ç¤¦¡£

audio/mpg123 ¤Ï¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤ÎÂåÂؤȤʤë MP3 ¥×¥ì¥¤¥ä¤Î port ¤Ç¤¹¡£

mpg123 ¤Ï¥µ¥¦¥ó¥É¥Ç¥Ð¥¤¥¹¤È MP3 ¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Æ¼Â¹Ô¤Ç¤­¤Þ¤¹¡£ /dev/dsp1.0 ¥Ç¥Ð¥¤¥¹¤ò»ÈÍѤ·¤Æ MP3 ¥Õ¥¡¥¤¥ë Foobar-GreatestHits.mp3 ¤òºÆÀ¸¤¹¤ë¤Î¤Ç¤¢¤ì¤Ð¡¢¼¡¤Î¤è¤¦¤Ë¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£

# mpg123 -a /dev/dsp1.0 Foobar-GreatestHits.mp3
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

8.3.2. CD ²»À¼¥È¥é¥Ã¥¯¤ÎÃê½Ð

CD Á´ÂΤޤ¿¤Ï CD ¥È¥é¥Ã¥¯¤ò MP3 ¤ËÊÑ´¹¤¹¤ëÁ°¤Ë¡¢CD ¾å¤Î¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤ò¥Ï¡¼¥É¥Ç¥£¥¹¥¯¾å¤ËÃê½Ð¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ ¤³¤ì¤Ë¤Ï raw CDDA (CD Digital Audio) ¥Ç¡¼¥¿¤ò WAV ¥Õ¥¡¥¤¥ë¤Ë¥³¥Ô¡¼¤·¤Þ¤¹¡£

sysutils/cdrtools ¥¹¥¤¡¼¥È¤Î°ìÉô¤Ç¤¢¤ë cdda2wav ¥Ä¡¼¥ë¤Ï CD ¤«¤é¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤òÃê½Ð¤·¤¿¤ê¡¢ ¾ðÊó¤ò´Ø·¸¤Å¤±¤ë¤Î¤Ë»È¤ï¤ì¤Þ¤¹¡£

CD ¤ò¥É¥é¥¤¥Ö¤Ë¤¤¤ì¤Æ¼¡¤Î¥³¥Þ¥ó¥É¤ò (root¤Ç) ¼Â¹Ô¤·¤Æ¡¢ CD Á´ÂΤò (¥È¥é¥Ã¥¯¤´¤È¤Ë) ¸Ä¡¹¤Î WAV ¥Õ¥¡¥¤¥ë¤ËÃê½Ð¤Ç¤­¤Þ¤¹¡£

# cdda2wav -D 0,1,0 -B

cdda2wav ¤Ï ATAPI (IDE) CDROM ¥É¥é¥¤¥Ö¤Ë¤âÂбþ¤·¤Æ¤¤¤Þ¤¹¡£ IDE ¥É¥é¥¤¥Ö¤«¤éÃê½Ð¤¹¤ë¤Ë¤Ï¡¢ SCSI ¥æ¥Ë¥Ã¥ÈÈÖ¹æ¤ò¥Ç¥Ð¥¤¥¹Ì¾¤ËÃÖ¤­´¹¤¨¤Æ»ØÄꤷ¤Þ¤¹¡£ ¤¿¤È¤¨¤Ð IDE ¥É¥é¥¤¥Ö¤«¤é¼·ÈÖÌܤΥȥé¥Ã¥¯¤òÃê½Ð¤¹¤ë¤Ë¤Ï¡¢ ¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£

# cdda2wav -D /dev/acd0 -t 7

-D 0,1,0 ¤Ï SCSI ¥Ç¥Ð¥¤¥¹ 0,1,0 ¤òɽ¤·¤Þ¤¹¡£ ¤³¤ì¤Ï cdrecord -scanbus ¤Î½ÐÎϤ˰ìÃפ·¤Þ¤¹¡£

¸Ä¡¹¤Î¥È¥é¥Ã¥¯¤òÃê½Ð¤¹¤ë¤Ë¤Ï¡¢ ¼¡¤Î¤è¤¦¤Ë -t ¥ª¥×¥·¥ç¥ó¤ò»ÈÍѤ·¤Þ¤¹¡£

# cdda2wav -D 0,1,0 -t 7

¾åµ­¤ÎÎã¤Ï¥ª¡¼¥Ç¥£¥ª CDROM ¤Î¼·ÈÖÌܤΥȥé¥Ã¥¯¤òÃê½Ð¤·¤Þ¤¹¡£ ÈϰϤò»ØÄꤷ¤Æ¡¢ ¤¿¤È¤¨¤Ð°ìÈÖÌܤ«¤é¼·ÈÖÌܤΥȥé¥Ã¥¯¤Þ¤ÇÃê½Ð¤·¤¿¤¤¾ì¹ç¡¢ ¼¡¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£

# cdda2wav -D 0,1,0 -t 1+7

dd(1) ¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤â ATAPI ¥É¥é¥¤¥Ö¾å¤Î¥ª¡¼¥Ç¥£¥ª¥È¥é¥Ã¥¯¤òŸ³«¤¹¤ë¤Î¤Ë»È¤ï¤ì¤Þ¤¹¡£ ²¿¤¬¤Ç¤­¤ë¤«¾Ü¤·¤¤¤³¤È¤Ï ¥ª¡¼¥Ç¥£¥ª CD ¤ÎÊ£À½¤Ë¤Ä¤¤¤Æ 項16.5.5 ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£

8.3.3. MP3 ¤Î¥¨¥ó¥³¡¼¥É

¸½ºß¡¢°ìÈ̤˹¥¤Þ¤ì¤Æ¤¤¤ë MP3 ¥¨¥ó¥³¡¼¥À¤Ï lame ¤Ç¤¹¡£ lame ¤Ï Ports Collection ¤Î audio/lame ¤Ë¼ýÏ¿¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

¼¡¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤È¡¢Ãê½Ð¤·¤¿ WAV ¥Õ¥¡¥¤¥ë audio01.wav ¤ò»È¤Ã¤Æ audio01.mp3 ¤ËÊÑ´¹¤·¤Þ¤¹¡£

# lame -h -b 128 \
--tt "¶Ê̾" \
--ta "¥¢¡¼¥Æ¥£¥¹¥È̾" \
--tl "¥¢¥ë¥Ð¥à̾" \
--ty "ǯ" \
--tc "¥³¥á¥ó¥È" \
--tg "¥¸¥ã¥ó¥ë" \
audio01.wav audio01.mp3

128 kbits ¤¬É¸½à¤Î¥Ó¥Ã¥È¥ì¡¼¥È¤Î¤è¤¦¤Ç¤¹¡£ ¿¤¯¤Î¿Í¤Ï¤µ¤é¤Ë¹â²»¼Á¤Î 160 kbits ¤Þ¤¿¤Ï 192 kbits ¤ò¹¥¤à¤Ç¤·¤ç¤¦¡£ ¥Ó¥Ã¥È¥ì¡¼¥È¤¬¹â¤¯¤Ê¤ë¤Ë¤Ä¤ì¤ÆºîÀ®¤µ¤ì¤ë MP3 ¥Õ¥¡¥¤¥ë¤Ï¿¤¯¤Î¥Ç¥£¥¹¥¯Îΰè¤ò¾ÃÈñ¤·¤Þ¤¹¤¬¡¢¤è¤ê¹â²»¼Á¤È¤Ê¤ê¤Þ¤¹¡£ -h ¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¤È “Ä㮹âÉʼÁ” ¥â¡¼¥É¤È¤Ê¤ê¤Þ¤¹¡£ --t ¤Ç¤Ï¤¸¤Þ¤ë¥ª¥×¥·¥ç¥ó¤Ï ID3 ¥¿¥°¤òÀßÄꤷ¤Þ¤¹¡£ ¤³¤Î¥¿¥°¤Ë¤Ï¤¿¤¤¤Æ¤¤¶Ê¤Î¾ðÊ󤬴ޤޤì¤Æ¤ª¤ê¡¢ MP3 ¥Õ¥¡¥¤¥ë¤Ë³ÊǼ¤µ¤ì¤Þ¤¹¡£ lame ¤Î¥Þ¥Ë¥å¥¢¥ë¤ò»²¾È¤¹¤ì¤Ð¾¤Î¥ª¥×¥·¥ç¥ó¤¬¸«¤Ä¤«¤ë¤Ç¤·¤ç¤¦¡£

8.3.4. MP3 ¤Î¥Ç¥³¡¼¥É

MP3 ¤«¤é¥ª¡¼¥Ç¥£¥ª CD ¤òºîÀ®¤¹¤ë¤Ë¤Ï¡¢ MP3 ·Á¼°¤òÈó°µ½Ì WAV ·Á¼°¤ËÊÑ´¹¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ XMMS ¤È mpg123 ¤ÎξÊý¤¬ MP3 ¤«¤éÈ󰵽̥ե¡¥¤¥ë·Á¼°¤Ø¤Î½ÐÎϤËÂбþ¤·¤Æ¤¤¤Þ¤¹¡£

XMMS ¤Ç¥Ç¥£¥¹¥¯¤Ø½ñ¤­½Ð¤¹ÊýË¡¤Ï¼¡¤ÎÄ̤ê¤Ç¤¹¡£

  1. XMMS ¤òµ¯Æ°¤·¤Þ¤¹¡£

  2. ±¦¥¯¥ê¥Ã¥¯¤Ç XMMS ¥á¥Ë¥å¡¼¤òɽ¼¨¤·¤Þ¤¹¡£

  3. Options ¤«¤é Preference ¤òÁªÂò¤·¤Þ¤¹¡£

  4. Output Plugin ¤ò “Disk Writer Plugin” ¤ËÊѹ¹¤·¤Þ¤¹¡£

  5. Configure ¤ò²¡¤·¤Þ¤¹¡£

  6. È󰵽̥ե¡¥¤¥ë¤ò½ñ¤­½Ð¤¹¥Ç¥£¥ì¥¯¥È¥ê¤òÆþÎÏ (¤Þ¤¿¤ÏÁªÂò) ¤·¤Þ¤¹¡£

  7. ÉáÃÊÄ̤ê XMMS ¤Ø MP3 ¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ß¤Þ¤¹¡£ ²»ÎÌ¤Ï 100% ¤Ç ¥¤¥³¥é¥¤¥¶¤ÎÀßÄê¤Ï¥ª¥Õ¤Ë¤·¤Þ¤¹¡£

  8. Play ¤ò²¡¤·¤Þ¤¹— XMMS ¤Ï MP3 ¤òºÆÀ¸¤·¤Æ¤¤¤ë¤«¤Î¤è¤¦¤Ëɽ¼¨¤·¤Þ¤¹¤¬¡¢ ²»À¼¤Ï¤­¤³¤¨¤Þ¤»¤ó¡£ ¼ÂºÝ¤Ë¤Ï MP3 ¤ò¥Õ¥¡¥¤¥ë¤Ë½ÐÎϤ·¤Æ¤¤¤Þ¤¹¡£

  9. ºÆ¤Ó MP3 ¤òÄ°¤±¤ë¤è¤¦¤Ë Output Plugin ¤ò°ÊÁ°¤Î¤è¤¦¤Ë¸µ¤ËÌ᤹¤Î¤ò˺¤ì¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£

mpg123 ¤Çɸ½à½ÐÎϤؽñ¤­½Ð¤¹ÊýË¡¤Ï¼¡¤ÎÄ̤ê¤Ç¤¹¡£

  1. mpg123 -s audio01.mp3 > audio01.pcm ¤ò¼Â¹Ô¤·¤Þ¤¹¡£

XMMS ¤Ï WAV ·Á¼°¤Ç¥Õ¥¡¥¤¥ë¤Ë½ñ¤­½Ð¤·¤Þ¤¹¤¬¡¢ mpg123 ¤Ï MP3 ¤ò PCM ¥ª¡¼¥Ç¥£¥ª¥Ç¡¼¥¿¤ËÊÑ´¹¤·¤Þ¤¹¡£ ξ·Á¼°¤Ï cdrecord ¤ò»È¤Ã¤Æ¥ª¡¼¥Ç¥£¥ª CD ¤òºîÀ®¤¹¤ë¤Î¤ËÍøÍѤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ burncd(8) ¤ò»È¤¦¾ì¹ç¤Ï raw PCM ¥Ç¡¼¥¿¤¬É¬ÍפǤ¹¡£ WAV ¥Õ¥¡¥¤¥ë¤ò»ÈÍѤ¹¤ë¾ì¹ç¡¢ ¤½¤ì¤¾¤ì¤Î¥È¥é¥Ã¥¯¤ÎÀèƬ¤Ë¾®¤µ¤Ê¥Î¥¤¥º¤¬Æþ¤ë¤Î¤Ëµ¤¤Å¤¯¤Ç¤·¤ç¤¦¡£ ¤³¤ì¤Ï WAV ¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¾ðÊó¤Ç¤¹¡£ SoX (audio/sox ¤Î port ¤Þ¤¿¤Ï package ¤«¤é¥¤¥ó¥¹¥È¡¼¥ë¤Ç¤­¤Þ¤¹) ¤ò»È¤¦¤È´Êñ¤Ë WAV ¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥À¾ðÊó¤òºï½ü¤Ç¤­¤Þ¤¹¡£

% sox -t wav -r 44100 -s -w -c 2 track.wav track.raw

FreeBSD ¤Ç¤Î CD ºîÀ®¤Î¾Ü¤·¤¤¾ðÊó¤Ï 項16.5 ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£

ËÜʸ½ñ¡¢¤ª¤è¤Ó¾¤Îʸ½ñ¤Ï ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/ ¤«¤é¥À¥¦¥ó¥í¡¼¥É¤Ç¤­¤Þ¤¹¡£

FreeBSD ¤Ë´Ø¤¹¤ë¼ÁÌ䤬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢¥É¥­¥å¥á¥ó¥È ¤òÆɤó¤À¾å¤Ç <questions@FreeBSD.org> ¤Þ¤Ç (±Ñ¸ì¤Ç) Ï¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£
ËÜʸ½ñ¤Ë´Ø¤¹¤ë¼ÁÌä¤Ë¤Ä¤¤¤Æ¤Ï¡¢<doc@FreeBSD.org> ¤Þ¤ÇÅŻҥ᡼¥ë¤ò (±Ñ¸ì¤Ç) Á÷¤Ã¤Æ¤¯¤À¤µ¤¤¡£