Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Ubuntu Linux Toolbox 1000+ Commands for Ubuntu and Debian Power Users phần 5 docx
MIỄN PHÍ
Số trang
35
Kích thước
479.7 KB
Định dạng
PDF
Lượt xem
924

Ubuntu Linux Toolbox 1000+ Commands for Ubuntu and Debian Power Users phần 5 docx

Nội dung xem thử

Mô tả chi tiết

PageDown, and the up arrow and down arrow keys to select channels. Use the right

or left arrow key to increase or decrease volume. Type m to mute the current channel.

Press the spacebar to select the current channel as the recording device. If a mouse is

available, you can use it to select volume levels, balance levels, or the current record￾ing channel.

Ripping CD Music

To be able to play your personal music collection from Linux, you can use tools such

as cdparanoia to rip tracks from music CDs to WAV files on your hard disk. The

ripped files can then be encoded to save disk space, using tools such as oggenc (Ogg

Vorbis), flac (FLAC), or lame (MP3).

NOTE There are some excellent graphical tools for ripping and encoding CDs,

such as grip and sound-juicer. Because they are CDDB-enabled, those tools

can also use information about the music on the CD to name the output files (artist,

album, song, and so on). This section, however, describes how to use some of the

underlying commands to rip and encode CD music manually.

Using cdparanoia, you can check that your CD drive is capable of ripping Compact

Disc Digital Audio (CDDA) CDs, retrieve audio tracks from your CD drive, and copy

them to hard disk. Start by inserting a music CD in your drive and typing the following:

$ cdparanoia -vsQ

...

Checking /dev/cdrom for cdrom...

Checking for SCSI emulation...

Checking for MMC style command set...

Verifying CDDA command set...

...

Table of contents (audio tracks only):

track length begin copy pre ch

===========================================================

1. 18295 [04:03.70] 0 [00:00.00] no no 2

2. 16872 [03:44.72] 18295 [04:03.70] no no 2

...

11. 17908 [03:58.58] 174587 [38:47.62] no no 2

12. 17342 [03:51.17] 192495 [42:46.45] no no 2

TOTAL 209837 [46:37.62] (audio only)

The snipped output shows cdparanoia checking the capabilities of /dev/cdrom,

looking for SCSI emulations and MMC command set support, and verifying that the

drive can handle CDDA information. Finally, it prints information about each track.

Here are examples of cdparanoia command lines for ripping a CD to a hard drive:

$ cdparanoia -B Rip tracks as WAV files by track name

$ cdparanoia -B -- “5-7” Rip tracks 5-7 into separate files

$ cdparanoia -- “3-8” abc.wav Rip tracks 3-8 to one file (abc.wav)

112

Chapter 6: Playing with Multimedia

82935c06.qxd:Toolbox 10/29/07 1:00 PM Page 112

$ cdparanoia -- “1:[40]-” Rip tracks 1 from 40 secs in to end of the CD

$ cdparanoia -f -- “3” Rip track 3 and save to AIFF format

$ cdparanoia -a -- “5” Rip track 5 and save to AIFC format

$ cdparanoia -w -- “1” my.wav Rip track 1 and name it my.wav

Encoding Music

After a music file is ripped from CD, encoding that file to save disk space is usually

the next step. Popular encoders include oggenc, flac, and lame, for encoding to Ogg

Vorbis, FLAC, and MP3 formats, respectively.

With oggenc, you can start with audio files or streams in WAV, AIFF, FLAC, or raw

format and convert them to Ogg Vorbis format. Although Ogg Vorbis is a lossy for￾mat, the default encoding from WAV files still produces very good quality audio and

can result in a file that’s about one-tenth the size. Here are some examples of oggenc:

$ oggenc ab.wav Encodes WAV to Ogg (ab.ogg)

$ oggenc ab.flac -o new.ogg Encodes FLAC to Ogg (new.ogg)

$ oggenc ab.wav -q 9 Raises encoding quality to 9

By default, the quality (-q) of the oggenc output is set to 3. You can set the quality to

any number from -1 to 10 (including fractions such as 5.5).

$ oggenc NewSong.wav -o NewSong.ogg \

-a Bernstein -G Classical \

-d 06/15/1972 -t “Simple Song” \

-l “Bernsteins Mass” \

-c info=”From Kennedy Center”

The command just shown converts MySong.wav to MySong.ogg. The artist name is

Bernstein and the music type is Classical. The date is June 15, 1972, the song title is

Simple Song and the album name is Bernsteins Mass. A comment is From Kennedy

Center. The backslashes aren’t needed if you just keep typing the whole command on

one line. However, if you do add backslashes, make sure there are no spaces after the

backslash.

The preceding example adds information to the header of the resulting Ogg file. You

can see the header information, with other information about the file, using ogginfo:

$ ogginfo NewSong.ogg

Processing file “NewSong.ogg”...

...

Channels: 2

Rate: 44100

Nominal bitrate: 112.000000 kb/s

User comments section follows...

info=From Kennedy Center

title=Simple Song

113

Chapter 6: Playing with Multimedia

82935c06.qxd:Toolbox 10/29/07 1:00 PM Page 113

artist=Bernstein

genre=Classical

date=06/15/1972

album=Bernsteins Mass

Vorbis stream 1:

Total data length: 3039484 bytes

Playback length: 3m:25.240s

Average bitrate: 118.475307 kb/s

Logical stream 1 ended

Here you can see that comments were added during encoding. The -c option was used

to set an arbitrary field (in this case, info) with some value to the header. Besides the

comments information, you can see that this file has two channels and was recorded at

a 44100 bitrate. You can also see the data length, playback time, and average bitrate.

The flac command is an encoder similar to oggenc, except that the WAV, AIFF,

RAW, FLAC, or Ogg file is encoded to a FLAC file. Because flac is a free lossless

audio codec, it is a popular encoding method for those who want to save some

space, but still want top-quality audio output. Using default values, our encoding

from WAV to FLAC resulted in files one-half the size, as opposed to one-tenth the

size with oggenc. Install the flac package to use the flac command. Here is an

example of the flac command:

$ flac now.wav Encodes WAV to FLAC (now.flac)

$ sox now.wav now.aiff Encodes WAV to AIFF (now.aiff)

$ flac now.aiff -o now2.flac Encodes AIFF to FLAC (now.flac)

$ flac -8 top.wav -o top.flac Raises compression level to 8

The compression level is set to -5 by default. A range from -0 to -8 can be used, with

the highest number giving the greatest compression and the lower number giving

faster compression time. To convert files to MP3 format using the lame command, you

must first install the lame package. Here are some examples of the lame command

to encode from WAV and AIFF files:

$ lame in.wav Encodes WAV to MP3 (in.wav.mp3)

$ lame in.wav --preset standard Encodes to MP3 with std presets

$ lame tune.aiff -o tune.mp3 Encodes AIFF to MP3 (tune.mp3)

$ lame -h -b 64 -m m in.wav out.mp3 High quality, 64-bit, mono mode

$ lame -q 0 in.wav -o abcHQ.mp3 Encodes with quality set to 0

With lame, you can set the quality from 0 to 9 (5 is the default). Setting the quality to 0

uses the best encoding algorithms, while setting it to 9 disables most algorithms (but

the encoding process moves much faster). As with oggenc, you can add tag information

to your MP3 file that can be used later when you play back the file. Here’s an example:

$ lame NewSong.wav NewSong.mp3 \

--ta Bernstein --tg Classical \

--ty 1972 --tt “Simple Song” \

--tl “Bernsteins Mass” \

--tc “From Kennedy Center”

114

Chapter 6: Playing with Multimedia

82935c06.qxd:Toolbox 10/29/07 1:00 PM Page 114

Tải ngay đi em, còn do dự, trời tối mất!