File: compact-discs.texinfo

package info (click to toggle)
linuxcookbook 1.2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,816 kB
  • ctags: 1
  • sloc: makefile: 40
file content (557 lines) | stat: -rw-r--r-- 16,775 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
@c $Id: compact-discs.texinfo,v 1.15 2001/05/16 16:57:50 m Exp m $
@node Compact Discs, Editing Sound, Sound Basics, Sound
@comment  node-name,  next,  previous,  up
@chapter Audio Compact Discs
@cindex audio compact discs
@cindex compact discs, audio

@noindent
Audio compact discs can be played on systems that have a CD-ROM drive
and sound card installed. You can control playback of an audio CD in all
the ways you can with a traditional CD player, except on a Linux system
you control playback with software tools on the command line. There are
tools for reading the audio data from a CD and writing it to a file
(which you can later write to a CD-R disc, or convert to MP3 format).

Tools and techniques for manipulating CD-ROMs (data CDs) are in
@ref{CD-ROMs, , CD-ROMs}.


@menu
* CD Control::                  Controlling CD audio.
* CD Sample::                   Making a sample of an audio CD.
* CD Write::                    Writing a CD-R.
* CD Applications::             More CD tools and applications.
@end menu

@node CD Control, CD Sample, Compact Discs, Compact Discs
@comment  node-name,  next,  previous,  up
@section Controlling CD Audio
@cindex controlling cd audio
@cindex audio CDs, controlling 
@pindex cdtool

@flushleft
@sf{Debian}: @file{cdtool}
@sf{WWW}: @url{ftp://jaka.cerl.uiuc.edu/pub/tinsel/}
@end flushleft
@*
@noindent
These recipes describe various ways to play audio CDs using the
command-line tools found in the @samp{CDTOOL} suite. Other CD audio
tools, including X clients, are listed in @ref{CD Applications, ,
Other Audio CD Applications}.

@menu
* CD Playing::                  Playing an audio CD.
* CD Pausing::                  Pausing an audio CD.
* CD Stopping::                 Stopping an audio CD.
* CD Shuffling::                Shuffling tracks.
* CD Info::                     Getting information on the current CD.
* CD Eject::                    Ejecting a disc.
@end menu


@node CD Playing, CD Pausing, CD Control, CD Control
@comment  node-name,  next,  previous,  up
@subsection Playing an Audio CD
@cindex playing an audio CD
@cindex audio CDs, playing
@pindex cdplay

@noindent
Use @code{cdplay} to play an audio CD in the CD-ROM drive; the sound is
output through the speakers connected to the LINE OUT jack on your sound
card. (You may need to use the audio mixer to adjust the volume level
and other settings; see @ref{Audio Settings, , Adjusting the Audio
Controls}.)

@itemize @bullet
@item
To play an audio CD, type:

@example
$ @kbd{cdplay @key{RET}}
@end example
@end itemize

To begin with a particular track, give the number of the track as an
argument.

@itemize @bullet
@item
To play an audio CD, beginning with the third track, type:

@example
$ @kbd{cdplay 3 @key{RET}}
@end example
@end itemize

To @emph{end} with a particular track, give the number of the track as
a second argument.

@itemize @bullet
@item
To play an audio CD, beginning with the first track and ending with the
fourth track, type:

@example
$ @kbd{cdplay 1 4 @key{RET}}
@end example

@item
To play only the third track of an audio CD, type:

@example
$ @kbd{cdplay 3 3 @key{RET}}
@end example
@end itemize


@node CD Pausing, CD Stopping, CD Playing, CD Control
@comment  node-name,  next,  previous,  up
@subsection Pausing an Audio CD
@cindex pausing an audio CD
@cindex audio CDs, pausing
@pindex cdpause

@noindent
Use @code{cdpause} to pause audio CD playback.

@itemize @bullet
@item
To pause the current CD playback, type:

@example
$ @kbd{cdpause @key{RET}}
@end example
@end itemize

Use @code{cdplay} to start playback at the point where it was paused; to
restart the playback from the beginning, use @code{cdplay} with @samp{x}
as an argument. 

@itemize @bullet
@item
To restart a paused CD, type:

@example
$ @kbd{cdplay @key{RET}}
@end example

@item
To restart a paused CD from the beginning, type:

@example
$ @kbd{cdplay x @key{RET}}
@end example
@end itemize


@node CD Stopping, CD Shuffling, CD Pausing, CD Control
@comment  node-name,  next,  previous,  up
@subsection Stopping an Audio CD
@cindex stopping an audio CD
@cindex audio CDs, stopping
@pindex cdstop

@noindent
To stop playback of an audio CD, use @code{cdstop}.

@itemize @bullet
@item
To stop the current CD playback, type:

@example
$ @kbd{cdstop @key{RET}}
@end example
@end itemize


@node CD Shuffling, CD Info, CD Stopping, CD Control
@comment  node-name,  next,  previous,  up
@subsection Shuffling Audio CD Tracks 
@cindex shuffling audio CD tracks 
@cindex audio CDs, shuffling tracks

@noindent
Use @code{cdplay} with the @samp{shuffle} argument to play the CD tracks
in random order.

@itemize @bullet
@item
To shuffle CD playback, type:

@example
$ @kbd{cdplay shuffle @key{RET}}
@end example
@end itemize


@node CD Info, CD Eject, CD Shuffling, CD Control
@comment  node-name,  next,  previous,  up
@subsection Displaying Information about an Audio CD
@cindex displaying information about an audio CD
@cindex audio CD, displaying information about an
@pindex cdinfo
@pindex cdir

@noindent
Use @code{cdinfo} to display information about an audio CD, including
its play status and track times. With no options, it outputs the play
status: @samp{play} if the CD is currently playing, @samp{paused} if the
CD is currently on pause, @samp{no-status} if the CD is not playing, and
@samp{nodisc} if no disc is in the drive.

@itemize @bullet
@item
For the current status of the audio CD in the CD-ROM drive, type:

@example
$ @kbd{cdinfo @key{RET}}
@end example
@end itemize

In addition, @code{cdinfo} recognizes the following options:

@multitable @columnfractions .30 .70
@item @sc{Option}
@tab @sc{Description}
@item @code{-a}
@tab Output the absolute disc time.

@item @code{-r}
@tab Output the relative track time.

@item @code{-s}
@tab Output the play status (the default action).

@item @code{-t}
@tab Output the current track.

@item @code{-v}
@tab Output all available information: play status, current track,
absolute disc time, and relative track time.
@end multitable

To show the lengths of all tracks on an audio CD in a directory-like
format, use @code{cdir}. This tool will also show titles and artist
names, if known, but for this to work, you must set up an audio CD
database (see the @code{cdtool} @code{man} page for details---@ref{Man,
, Reading a Page from the System Manual}).

@itemize @bullet
@item
To show a list of tracks, type:

@example
@cartouche
$ @kbd{cdir @key{RET}}
unknown cd - 43:14 in 8 tracks
  5:15.00  1 
  5:50.40  2 
  5:29.08  3 
  3:50.70  4 
  4:17.00  5 
  5:56.15  6 
  7:13.40  7 
  5:19.22  8 
$
@end cartouche
@end example
@end itemize

In this example, the CD contains eight tracks, with a total of 43
minutes and 14 seconds play time.


@node CD Eject, , CD Info, CD Control
@comment  node-name,  next,  previous,  up
@subsection Ejecting an Audio CD
@cindex ejecting an audio CD
@cindex audio CDs, ejecting
@pindex cdeject

@noindent
Use @code{cdeject} to eject the disc in the CD-ROM drive. If the disc is
currently playing, play will stop and the disc will eject.

@itemize @bullet
@item
To eject a CD, type:

@example
$ @kbd{cdeject @key{RET}}
@end example
@end itemize

@sp .25
@noindent
@strong{NOTE:} This command will also eject a CD-ROM (data CD), if the
CD-ROM is not currently mounted (@pxref{CD-ROMs, , CD-ROMs}).


@node CD Sample, CD Write, CD Control, Compact Discs
@comment  node-name,  next,  previous,  up
@section Sampling Sound from a CD
@cindex sampling sound from a CD
@cindex ripping sound from a CD
@cindex sound, sampling from a CD
@cindex CD, sampling sound from a
@pindex cdparanoia
@pindex cdda2wav

@flushleft
@sf{Debian}: @file{cdda2wav}
@sf{Debian}: @file{cdparanoia}
@sf{WWW}: @url{ftp://ftp.gwdg.de/pub/linux/misc/cdda2wav/}
@sf{WWW}: @url{http://www.mit.edu/afs/sipb/user/xiphmont/cdparanoia/index.html}
@end flushleft
@*
@noindent
Two tools used for sampling (sometimes called ``ripping'') data from an
audio CD are @code{cdda2wav} and @code{cdparanoia}. Both can retrieve
single tracks or entire disks; the former is the archetypal CD
audio-sampling tool for Linux, and should be used when speed is more
important than sound quality. The latter does various extra checks for
the paranoid, and should be used when an absolutely perfect copy is
necessary---at the expense of speed. @code{cdda2wav} is perfectly
capable of creating a digitally perfect audio sample; @code{cdparanoia}
is useful for when your original CD may have scratches (its scratch
detection capability can attempt to ``hold sync'' across the scratch),
or for when you are using a less-than-optimal-quality CD-ROM drive.

With @code{cdda2wav}, you specify the track number to be retrieved as an
argument to the @samp{-t} option; use @samp{x} to specify a CD-quality
retrieval, and give the name of the CD-ROM device with the @samp{-D}
option---unless you have multiple CD-ROM drives installed, this is
almost certainly going to be @file{/dev/cdrom}.

By default, files are written as WAV format files; use the @samp{-O}
option followed by @samp{cdr} to write the files in CD audio
format. @file{.cdr} files are useful for burning an audio CD containing
the files as tracks (discussed in the following section), and
@file{.wav} files are useful for converting to MP3 format
(@pxref{Encoding MP3, , Making an MP3 File}). You can convert either
format to the other at a later time with @code{sox}---see
@ref{Converting Sound, , Converting Sound Files}.

@itemize @bullet
@item
To copy track seven of an audio CD to a CD-quality WAV file in the
current directory, type:

@example
$ @kbd{cdda2wav -t7 -d0 -x -D /dev/cdrom @key{RET}}
@end example

@item
To copy all tracks on an audio CD to separate CD-quality CD audio-format
files, type:

@example
$ @kbd{cdda2wav -D /dev/cdrom -x -O cdr -d0 -B @key{RET}}
@end example
@end itemize

For more reliable sampling, use @code{cdparanoia}. Give the range of
audio tracks to sample as an argument (with no arguments, it samples the
entire disc). Use the @samp{-w} option to specify WAV format output.

@itemize @bullet
@item
To sample the third track from a scratched audio CD in the default
CD-ROM drive using ``paranoid'' data verification, and write the output
to a WAV format file in the current directory, type:

@example
$ @kbd{cdparanoia -w 3-3 @key{RET}}
@end example

@item
To sample the entire audio CD using ``paranoid'' data verification,
type:

@example
$ @kbd{cdparanoia -w -B @key{RET}}
@end example

@item
To sample the entire audio CD using less-than-maximum ``paranoid'' data
verification, without checking for scratches, and saving each song as a
separate raw audio-format file in the current directory, type:

@example
$ @kbd{cdparanoia -B -Y -X @key{RET}}
@end example
@end itemize

@sp .25
@noindent
@strong{NOTE:} Sampling an entire audio CD can use a lot of disk space;
most people delete the @file{.cdr} or @file{.wav} files as soon as they
make MP3s or burn an audio CD-R from the data.


@node CD Write, CD Applications, CD Sample, Compact Discs
@comment  node-name,  next,  previous,  up
@section Writing an Audio CD-R
@cindex writing an audio CD-R
@cindex CD-R, writing an audio
@cindex audio CD-Rs, writing
@cindex multisession CD-Rs, burning
@pindex cdrecord

@flushleft
@sf{Debian}: @file{cdrecord}
@sf{WWW}: @url{http://freshmeat.net/projects/cdrecord/}
@end flushleft
@*
@noindent
Use @file{cdrecord} to write (or ``burn'') audio files to a blank CD-R
disc. You will need a CD-R drive@footnote{You can also use this tool
with a CD-RW drive and write to a CD-RW disc.} and the audio files must
be in CD-DA CD audio format (they usually have a @file{.cdda} or
@file{.cdr} file name extension).

Specify the CD-R drive with the special @samp{dev} argument, which is
given in this form:

@example
@samp{dev=@var{scsibus},@var{target},@var{lun}}
@end example

@noindent
where @var{scsibus} is the number of the SCSI bus (0 for the primary
bus), @var{target} is the SCSI target ID (usually a number from 1 to 6),
and @var{lun} is its LUN number (most always 0).

Use the @samp{speed} argument to set the speed factor for writing data:
give @samp{speed=2} to specify double speed or @samp{speed=4} to specify
quad speed.

Use the @samp{-dummy} option to run with the drive laser turned off, so
no actual burning takes place; this is useful when you are first using a
CD-R drive and need to test your configuration to make sure you've got
it right. Another useful option is @samp{-v}, which gives a more
@emph{verbose} message output.

Give the names of the audio files to burn, in the order that they should
appear on the disc, as arguments to the @samp{-audio} option. The files
are written in CD-DA CD audio format, and they should contain 16-bit
stereo at 44,100 samples/second (the @file{.cdr} or @file{.cdda} files
meet this criterion).

@itemize @bullet
@item
To burn the file @file{symphony.cdr} to the disc in the CD-R drive whose
target ID is 2 on the primary SCSI bus, type:

@example
$ @kbd{cdrecord dev=0,2,0 -audio symphony.cdr @key{RET}}
@end example

@item 
To burn all the files in the current directory ending with a @file{.cdr}
extension at double speed to the CD-R drive whose target ID is 2 on the
primary SCSI bus, and give verbose output, type:

@example
$ @kbd{cdrecord dev=0,2,0 speed=2 -v -audio *.cdr @key{RET}}
@end example

@item
To run a test burn of the file @file{symphony.cdr} to the disc in the
CD-R drive whose target ID is 6 (LUN 1) on the primary SCSI bus, type: 

@example
$ @kbd{cdrecord dev=0,6,1 -dummy -audio symphony.cdr @key{RET}}
@end example
@end itemize

When you use wildcards for files, as in the second-to-the-last example,
the shell expands the files in alphabetical order. To write a group of
tracks in a particular order without specifying all of their names as
arguments, rename them so that their names begin with numbers that
correspond to the order you want to write them in (@pxref{Moving Files,
, Moving Files and Directories}).

For example, if you have the three files @file{morning-song.cdr},
@file{midday-song.cdr}, and @file{evening-song.cdr}, and you want to
write them in that order, rename the files to
@file{01-morning-song.cdr}, @file{02-midday-song.cdr}, and
@file{03-evening-song.cdr}; otherwise, if you specify them as
@file{*.cdr}, the shell will sort their names so that they will be
written to CD-R in the order of @file{evening-song.cdr},
@file{midday-song.cdr}, and @file{morning-song.cdr}---exactly the
opposite of what was intended!

To write a disc containing both data and audio tracks, first specify the
file for the data track (it should contain a filesystem image in either
ISO 9660 or Rock Ridge format), and then follow it with the
@samp{-audio} option and the names of the audio tracks to use. The
resulting CD-R will be both mountable as a data CD and playable on audio
CD players (the first track on the disc, the data track, will be skipped
when playing the audio).

@itemize @bullet
@item
To burn the data track @file{band-info} and all the audio tracks in the
current directory with a @file{.cdda} extension to the CD-R
drive whose target ID is 2 on the primary SCSI bus, type:

@example
$ @kbd{cdrecord dev=0,2,0 band-info -audio *.cdda @key{RET}}
@end example
@end itemize

@sp .25
@noindent
@strong{NOTE:} When writing an audio CD, you should have as few
processes running as possible. If @code{cdrecord} has to pause even
momentarily to let the system shuffle other processes, the CD-R could be
ruined! For this reason, it is advisable to avoid switching between
consoles---or between windows, if running X---during the CD-R burning
process.


@node CD Applications, , CD Write, Compact Discs
@comment  node-name,  next,  previous,  up
@section Other Audio CD Applications
@cindex other audio CD applications
@cindex audio cd applications
@pindex dynamic
@pindex workbone
@pindex workman
@pindex xcdroast

@noindent
The following table lists some of the other available tools and
applications that work on audio compact discs.

@multitable @columnfractions .20 .80
@item @sc{Tool}
@tab @sc{Description}
@item @code{dynamic}
@tab Project Dynamic is a tool for playing samples of audio CDs; it is
distinctive in that it can play audio CDs @emph{backwards}.

@noindent
{@sf{WWW}}: @url{http://www.cse.unsw.edu.au/~flatmax/dynamic/}

@item @code{workbone}
@tab An interactive CD player that can be used on the console or in X;
it allows you to skip forward and backward through tracks as they are
playing.

@item @code{workman}
@tab A tool for playing audio CDs, with a graphical interface that looks
like the front panel of a physical CD player.

@item @code{xcdroast}
@tab XCDRoast is a graphical front-end to the @code{cdrecord} tool for
use in X.

@noindent
{@sf{WWW}}: @url{http://www.xcdroast.org/}
@end multitable