1Hi dear cdrom drive users, 2 3This README describes hardware related matters as well as the installation of 4cdda2wav, the sampling utility. 5 6The last big change was the inclusion in Joerg Schillings cdrecord package 7as you may have noticed :-) 8That means most of the cdrecord interfacing applies for cdda2wav as well. 9 10I decided to retire the standalone version slowly, and to do all new 11development in this bundled variant. 12 13Requirements 14============ 15 16For SCSI cdroms and CD-writers, as well as SCSI-emulated ATAPIS and parallel 17 port drives 181s. kernel support for SCSI, the host adapter, SCSI cdroms and the 19 generic SCSI interface (if under Linux). You need to have the proper device 20 descriptors (get them under Linux with the MAKEDEV script from /dev). 21 22For ATAPI cdroms under Linux 231a. kernel support for the ATAPI cdrom driver or alternatively ide-scsi 24 emulation. You need to have the proper device descriptors (get them 25 with the MAKEDEV script from /dev). 26 27For parallel port cdroms under Linux 28 With newer kernels cdda2wav uses the same parallel port access 29 as does cdrecord. Please refer additionally to the cdrecord documentation. 30 There are generally two drivers to access the cdrom through the parallel 31 port: the ATAPI cd emulation (called pcd), and the SCSI device emulation 32 (called pg). The pcd driver does NOT support cdda reading (kernel 2.2.12), 33 while the pg driver has no restriction. So you have to use pg for that. 34 35 36For cdrom drives with proprietary busses under Linux 371p. Please check the CDROM-HOWTO for features of the respective 38 drivers. The sbpcd driver is very demanding due to the lack of 39 interrupts. 40 41optionally currently for Solaris and all platforms running 4fronts 42OpenSoundSystems: 432. kernel sound card support. 44 45 46Recommendations for higher throughput on Linux SCSI systems 47=========================================================== 48 49Higher throughput will give better chances for non-interrupted 50sampling. This should avoid typical interruption errors (cracklings 51at buffer boundaries). 52 531. Increase SG_BIG_BUFF to (128*1024) in /usr/src/linux/include/scsi/sg.h 54 (and recompile your kernel and boot it :-). 55NOTE: Some kernel configurations will lead to 'out of kernel memory' errors. 56 If you encounter this message regularly, better leave SG_BIG_BUFF at 57 32768. 58 591a.There is a patch for multiple sg device access under Linux. It uses 60 up to 128 K buffer for each device. See here: 61ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/alpha/sg* 62 632. Ensure your harddisk has write cache enabled (For SCSI hard disks I 64 switched it on with the scsiinfo program from tsx-11.mit.edu), but 65 enable this only if it is correctly working ;-) 66 67This has boosted the throughput of cdda2wav considerably. 68 69 70Supported interfaces 71==================== 72 73Non SCSI drives (Linux only): 74 ATAPI: 75 The greatest group nowadays are ATAPI (EIDE) cdrom drives. 76 Support is only limited by the drive. Kernel and cdda2wav 77 are ready for them (unless the drive uses a very uncommon method). 78 79 Newer kernels can do an scsi emulation for ATAPI devices. 80 This interface is supported. 81 82 Parallel port interface: 83 There is a driver that maps the parallel port driver to an generic 84 scsi like driver. Should work with newer kernels. 85 86 Proprietary interfaces: 87 Older drives with proprietary interfaces are supported only 88 if the kernel driver allows reading cdda audio data via ioctl(). 89 Currently only Eberhard Moenkeberg's sbpcd and Corey Minyard's 90 cdu31a driver do allow this. The sbpcd driver of kernels earlier than 91 2.0.30 and 2.1.57 needs a patch before satisfying output can be 92 obtained (see README.sbpcd). 93 94SCSI drives: 95 For these drives the SCSI library from Joerg Schilling is used. 96 Thus we need kernel support (compiled-in or as a module) for it. 97 The generic SCSI interface allows multi sector transfers (max. 128 KB) 98 which lowers cpu load considerably. 99 100 ** NEW ** 101 I added a script 'scsi_scan.linux' to find the generic devices for all 102 SCSI CDROM- or WORM-type drives. 103 104Configuration 105============= 106 107There are some adjustable parameters in the beginning of the Makefile 108(which is called local.cnf.in) . They describe default settings of cdda2wav: 109 110INTERFACE: How the cdrom is accessed. Choose one method for INTERFACE. 111DEVICE: The default cdrom device is set in DEF_DEVICE. 112 113SOUND FILE FORMAT DEFAULTS: 114The default format can be 'wav', 'sun pcm au', 'aiff', 'aifc', or 115'raw bigendian samples'. 116It is determined by the Makefile variable DEF_TYPE. 117 118AUDIO FILENAME: 119The default filename is given by DEF_FILE. Unless 'cdr' format is being used, 120this name is appended with '.wav', '.au', '.aiff' or '.aifc'. 121 122RATE: the default rate is given by setting DEF_UNDERSAMPLING to the divisor 123for the audio cd sampling frequency (44100 Hz). 124 125 RATE = 44100 Hz / DEF_UNDERSAMPLING 126 127DEF_UNDERSAMPLING can be any multiple of a half greater than one half. 128 129DYNAMIC: The default dynamic range of one sample in one channel is defined in 130DEF_BITS which can be one of 8, 12 or 16. 131 132CHANNELS: set DEF_CHANNELS to 1 for mono and 2 for stereo. 133 134RECORDING TIME: set DEF_TIME to the amount of seconds to record (or 0 for 135the whole track). 136 137SOUND DEVICE: set SOUND_DEVICE to the device name of your sound card. 138 The line containing HAVESOUND should be 139 uncommented also, if you want the option to hear 140 what you record. 141 142All of those values can be overridden by command line parameters. 143 144 145Compiling cdda2wav 146================== 147 148Adjust the Makefile (named local.cnf.in) for your cdrom interface and 149device setting first. 150 151Then type 152 make 153and as root 154 make install 155 156This will compile cdda2wav and copy the binary to /usr/local/bin and the 157man page to /usr/local/man/man1 (defaults). 158 159 160Privileges 161========== 162 163You can setgid the binary, if you want to allow access to a CDROM's 164scsi_generic interface for cdda2wav but not for arbitrary programs. 165Giving away permissions to send SCSI commands directly to a device is 166not something you want to do lightly on a multi-user server system. 167The setgid privileges will only be used to access the scsi generic 168interface; for cooked_ioctl, the setgid privileges are not necessary 169and they are simply dropped. 170 171Previous versions of cdda2wav had to be setuid to root. Such privileges 172are no longer necessary and will be dropped if present. 173 174Select device 175============= 176 177By default cdda2wav uses the generic SCSI interface and a device tripel for 178SCSI bus, id, and lun. 179This setting can be overridden by specifying '-Iinterface' and 180'-D cdromdevice'. 181The following command line example uses the generic_scsi interface and the 182SCSI device with bus 1, id 2 and lun 3: 183cdda2wav -Igeneric_scsi -D1,2,3 184 185The shell script 'scan_scsi.linux' will report the generic devices for 186all SCSI cdrom drives. 187 188If you need to use another interface, check the device setting also as they 189need to fit together. 190Here is an example for an ATAPI cdrom using the cooked_ioctl interface and 191the cdrom device /dev/hdb: 192cdda2wav -Icooked_ioctl -D/dev/hdb 193 194 195Features 196======== 197 198I added an optional on-the-fly correction for pre-emphasized samples 199(available for original CDDA format only). 200If the -T option is given, the samples will be filtered before they 201are written to disk. The samples then have a linear frequency response again. 202 203When recording in mono, both channels are summed with halved amplitude. 204 205Undersampling is done by summing several samples with reduced amplitude to 206prevent overflows. This damps higher freqencies as well. Compared to 207exact resampling cdda2wav does not use a very sophisticated (expensive) 208filter algorithm. It currently uses quadratic interpolation for 209noninteger subsampling factors. 210 211Sampling can be aborted by pressing the Interrupt-Key (eg control-C) 212at anytime. Unless streaming to a pipe, the wav header will be updated 213to contain the actual length of the sample. The same will happen, if 214disk space becomes exhausted. 215 216Fast options 217============ 218 219The options can also influence the performance greatly. 220The fastest case is given when the samples don't need to be changed from 221their original form or analysed, that is the output format uses the same 222parameters as the drive: 16-bit samples, stereo at 44100 Hz sample rate 223AND with the same endianess (-Cbig and -Ebig, or -Clittle and -Elittle). 224To be sure all parameters can be given explicitly on the command line. 225This avoids an analysis of cdda2wav. 226 227cdda2wav -P0 -q -S<maximum speed> 228run as root will read with maximum speed and copy its output into the 229wav file, taking advantage of realtime scheduling as well. 230 231For throughput testing the additional option -N can be used. Write 232operations will be suppressed then. 233 234Options that slow down initially 235================================ 236-v<level> needs some time for analysis before the actual sampling starts 237 238Options that slow down during sampling 239====================================== 240-P1 causes overlap reading, the slowdown depends on the amount of jitter 241-e synchronous output to a sound card slows down to onefold speed 242 243Options that need more cpu power 244================================ 245-p<rate> resamples the output send to the sound card 246-M<count> calculates checksums 247-T on-the-fly preemphasis filtering 248-F checking for extremal samples 249-G checking for differences in both channels 250-C<endianess> if a conversion is required (see below) 251-E<endianess> if a conversion is required (see below) 252-Oaudiotype if a conversion is required (see below) 253-c 1 254-c s 255-m 256-b 8 257-b 12 258-a <not 1> 259-r <not 44100> 260 261When are one or two endianess (byte order) conversions required? 262================================================================ 263There are three stages where the endianess matters: 2641.) on the input side the cd drive can deliver in two flavors (called F1). 265 When the flavor is unknown, cdda2wav needs to find out the endianess. 266 A simple voting method is used. Successive samples are compared in both 267 flavors and the flavor with the statistically smaller changes is taken. 268 The flavor can be defined with the -C option, avoiding the analysis. 2692.) For any calculation with samples (and echoing to the sound card), 270 the samples are needed in the byte order of the machine (in this case 271 I set 'need_host_order' to yes). The flavor of the machine endianess 272 is called F2. 2733.) Finally, there are two flavors of output sound formats (called F3): 274 wav uses little endian samples 275 cdr and au use big endian samples 276 If the samples currently in memory have the wrong endianess a 277 (possibly second) conversion is required. 278 279This gives the following table: 280F1 F2 need_host_order F3 conversions 281little little no little 0 282little little yes little 0 283little little no big 1 284little little yes big 1 285little big no little 0 286little big yes little 2 287little big no big 1 288little big yes big 1 289big little no little 1 290big little yes little 1 291big little no big 0 292big little yes big 2 293big big no little 1 294big big yes little 1 295big big no big 0 296big big yes big 0 297 298 299Known problems 300============== 301 3021. Sound quality 303 304Audible errors caused by hesitations: 305 306When recording the same audio track twice, recordings can slightly differ. 307Furthermore depending on the firmware in the cdrom drive, positioning 308errors can be so severe that they cannot be easily corrected by cdda2wav. 309This will unfortunately lead to audible errors. 310 311In this case some overlap or even underlap between successive portions 312is introduced from the cdrom drive. 313Here is this case demonstrated graphically: 314 315Sec 1 ... Sec n 316|----------------------| first read delivered 317 |------------------------| second read wanted 318 |------------------------| second read delivered 319 |-| extra bogus bytes 320 |-| missing bytes 321 322This is due to synchronisation problems between sectors inside the cdrom 323drive. When the drive has been forced to wait, these problems arise. 324 325Audio cds are lacking sector headers, so it's a difficult job to do the 326positioning right (in the firmware). The frequency of these errors is 327reduced when the reading process can continue undisturbed for longer periods. 328So, a high throughput is essential. 329 330You may want to fine-tune your update daemon to use shorter intervals 331(see 'man 8 update'). Shorter intervals are better because the update 332interruptions are shorter when not so much write requests can pile up. 333 334The plextor 4plexplus drive (PX-4XCE) and newer models, newer pioneer 335models as well as CD-writers with large buffers don't suffer from this 336errors. Here the default is to switch off overlap reading. 337 338If you cannot get good samples from your drives you might consider an 339alternative program. Monty's cdparanoia program goes to great lengths 340in order to separate the good bits from the bad ones. 341 3422. The index scanner has caused timeouts on my toshiba 3401 due to fast 343 random accesses. 344 3453. Retrieval of media catalog numbers and International Standard Recording 346 Codes may fail due to firmware bugs. 347 348Audio Format Conversion 349======================= 350Currently wav, sun (au-pcm), Apple/SGI aiff/aifc, and raw formats are supported. 351 352I try to write correct wav files (little endian samples), but some 353cd-writers might swap them, which would result in sort of white noise 354instead of the original sounds. Cdda2wav has an endianness detector 355for these cases, but as for all automatics, it might fail on bizarre samples. 356 357Hint: Cdda2wav can be forced to use a given input endianness with the 358-C option (arguments are 'little', 'big' or 'guess'). 359 360The sun format is a pcm variant, and uses big endian samples. 361The other more common sun format with logarithmically scaled samples (au) 362is not supported but can be obtained from sox's conversion. 363 364The raw format is like the sun format except it has no header. I 365changed the endianness to big endian samples in order to comply 366with popular cd burning software like the cdrecord program. 367 368The sound converter 'sox' can be used to obtain other sound formats. 369(Note however, that the current sox player and a newer sound driver do not 370harmonize well, use the player from the wavplay package instead (available 371at sunsite)). 372 373 374Feedback 375======== 376 377Tested patches, any hardware information regarding drives as well as success/ 378failure reports are always welcome at heiko@colossus.escape.de. 379 380 381known cdda capable drives 382========================= 383Check out these web pages for uptodate information: 384 385<http://www.tardis.ed.ac.uk/~psyche/pc/cdrom/CDDA.html> 386 387and 388 389<http://www.anime.net/~goemon/linux-cd/cdda-list.html> 390 391From a news posting from Bj�rn Wiberg 392 393> The following table was generated using the CDROM.CFG file from Nero 394> v3.0.4.2. 395> 396> It shows different CD-ROM models and what speeds they can do DAE at. I 397> guess the values are "safe ones"; i.e. the speeds at which each drive 398> can perform DAE reliably. 399> 400> A value of "0x" means the drive doesn't support DAE. 401> 402> For your convenience, the maximum data transfer speed of the drives 403> (for reading conventional files and data from the CD-ROM) are also 404> included. 405> 406> Hopefully, this will help some of you who are looking for a good 407> CD-ROM drive to choose a model which seems fast enough both for data 408> and DAE. 409> 410> The models which support DAE: 411> (Sorted by DAE speed, data speed and model) 412> 413> CD-ROM model DAE Data Interface 414> --------------------------------------------------------- 415> PLEXTOR CD-ROM PX-32TS 16x 16x SCSI 416> TEAC CD-524E 14x 24x IDE 417> CREATIVE CD620E 12x 5x IDE 418> MITSUMI CD-ROM FX320S !B 12x 32x IDE 419> TEAC CD-532E 12x 32x IDE 420> HITACHI CDR-8335 12x 24x IDE 421> PIONEER CD-ROM DR-A02S 12x 24x IDE 422> TEAC CD-ROM CD-532S 12x 14x SCSI 423> PIONEER CD-ROM DR-A12X 12x 12x IDE 424> PIONEER CD-ROM DR-U06S 12x 12x SCSI 425> PLEXTOR CD-ROM PX-20TS 12x 12x SCSI 426> MITSUMI CD-ROM FX120T !B 11x 12x IDE 427> PIONEER CD-ROM DR-A04S 11x 32x IDE 428> PIONEER CD-ROM DR-U12X 10x 12x SCSI 429> HITACHI CDR-8330 9x 24x IDE 430> SONY CD-ROM CDU711 9x 14x IDE 431> MATSHITA CD-ROM CR-584 9x 12x IDE 432> MATSHITA CD-ROM CR-586 8x 32x IDE 433> CDM-T531 Ver1.041 8x 18x IDE 434> TEAC CD-516E 8x 16x IDE 435> TOSHIBA CD-ROM XM-6201TA 8x 16x SCSI 436> PLEXTOR CD-ROM PX-12CS 8x 12x SCSI 437> PLEXTOR CD-ROM PX-12TS 8x 12x SCSI 438> PIONEER CD-ROM DR-U10X 8x 10x SCSI 439> SONY CD-ROM CDU611 8x 10x IDE 440> FUNAI E285X 8x 8x IDE 441> MITSUMI CD-ROM FX810T4!B 8x 8x IDE 442> SONY CD-ROM CDU511 8x 8x IDE 443> SONY CD-ROM CDU571-Q 8x 8x IDE 444> TEAC CD-C68E 8x 8x IDE 445> MITSUMI CD-ROM FX400E !B 8x 4x IDE 446> HITACHI CDR-8130 7x 16x IDE 447> MATSHITA CD-ROM CR-585 6x 24x IDE 448> CREATIVE CD2422E MC102 6x 12x IDE 449> MATSHITA CD-ROM CR-508 6x 12x SCSI 450> IBM PD-1 LF-1195 6x 6x IDE 451> PLEXTOR CD-ROM PX-6XCS 6x 6x SCSI 452> LITEON CD-ROM LTN301 5x 32x IDE 453> LITEON CD-ROM LTN242F 5x 24x IDE 454> HITACHI CDR-7930 5x 8x IDE 455> ASUS CD-S340 4x 34x IDE 456> E-IDE CD-ROM 32X/AKU 4x 32x IDE 457> ATAPI CDROM 4x 24x IDE 458> LITEON CD-ROM LTN244 4x 24x IDE 459> PHILIPS PCA248CD 4x 24x IDE 460> TEAC CD-524EA 4x 24x IDE 461> LITEON CD-ROM LTN202 4x 21x IDE 462> ATAPI CD-ROM DRIVE-24X 4x 20x IDE 463> CREATIVE CD2423E NC101 4x 20x IDE 464> SAMSUNG CD-ROM SCR-2431 4x 20x IDE 465> TAE IL CD-ROM CDD-7240J 4x 20x IDE 466> TEAC CD-220E 4x 20x IDE 467> CREATIVE CD1620E SL970404 4x 16x IDE 468> LITEON CD-ROM LTN262 4x 16x IDE 469> TEAC CD-ROM CD-516S 4x 16x SCSI 470> ATAPI CD-ROM DRIVE 4x 15x IDE 471> BCD 16XA CD-ROM 4x 10x IDE 472> MATSHITA CD-ROM CR-506 4x 8x SCSI 473> SONY CD-ROM CDU311 4x 8x IDE 474> MATSHITA CD-ROM CR-504-J 4x 4x SCSI 475> MITSBISH CDRW226 4x 4x SCSI 476> SONY CD-ROM CDU625-S 4x 4x SCSI 477> SONY CD-ROM CDU-76S 4x 4x SCSI 478> SONY CD-ROM CDU77E 4x 4x IDE 479> PLEXTOR CD-ROM PX-4XCE 4x 4x SCSI 480> SONY CD-ROM CDU55E 4x 2x IDE 481> PIONEER CD-ROM DR-U24X 3x 24x SCSI 482> LITEON CD-ROM LTN204 3x 21x IDE 483> PIONEER CD-ROM DR-A01S 3x 20x IDE 484> PIONEER CD-ROM DR-A24X 3x 20x IDE 485> FUNAI E295X 3x 16x IDE 486> PIONEER CD-ROM DR-U03S 3x 12x SCSI 487> BTC 24X CD-ROM SLL24 3x 10x IDE 488> PLEXTOR CD-ROM PX-8XCS 3x 4x SCSI 489> CyberDrv CD-ROM TW240S 3x 3x SCSI 490> COMPAQ CRD-8320B 2x 32x IDE 491> LG CD-ROM CRD-8320B 2x 32x IDE 492> TOSHIBA CD-ROM XM-6202B 2x 32x IDE 493> CREATIVE DVD-ROM DVD2240E 2x 24x IDE 494> TOSHIBA CD-ROM XM-6102D 2x 24x IDE 495> BTC 16X CD-ROM SLL16 1x 10x IDE 496> NEC CD-ROM DRIVE:282 2x 8x IDE 497> HITACHI GD-2000 2x 4x IDE 498> MATSHITA CD-ROM CR-581 2x 4x IDE 499> NEC CD-ROM DRIVE:222 2x 4x SCSI 500> MATSHITA CD-ROM CR-8004 2x 2x SCSI 501> GoldStar CD-ROM CRD-8240B 1x 24x IDE 502> TOSHIBA CD-ROM XM-6102B 1x 24x IDE 503> CyberDrv IDE CD-ROM 120D 1x 12x IDE 504> I DE CD-ROM TW120D 1x 12x IDE 505> NEC CD-ROM DRIVE:464 1x 12x SCSI 506> TORiSAN CD-ROM CDR_U112 1x 12x IDE 507> TOSHIBA CD-ROM XM-5701TA 1x 12x SCSI 508> TOSHIBA CD-ROM XM-5702B 1x 12x IDE 509> CyberDrv SCSI CD-ROM 120S 1x 10x IDE 510> NEC CD-ROM DRIVE:463 1x 10x SCSI 511> COMPAQ DVD-ROM SD-M1002 1x 8x IDE 512> MATSHITA CD-ROM CR-583 1x 8x IDE 513> NEC CD-ROM DRIVE:462 1x 8x SCSI 514> TEAC CD-58E 1x 8x IDE 515> OPTICS_S 8622 SCSI 1x 8x SCSI 516> TOSHIBA CD-ROM XM-5602B 1x 8x IDE 517> TOSHIBA CD-ROM XM-3801TA 1x 7x SCSI 518> NEC CD-ROM DRIVE:461 1x 6x SCSI 519> IBM CDRM00203 1x 6x SCSI 520> TEAC CD-46E 1x 6x IDE 521> TEAC CD-56E 1x 6x IDE 522> TEAC CD-ROM CD-56S 1x 6x SCSI 523> TOSHIBA CD-ROM XM-5502TA 1x 6x IDE 524> TOSHIBA CD-ROM XM-3701TA 1x 6x SCSI 525> NEC CD-ROM DRIVE:502 1x 4x SCSI 526> TOSHIBA CD-ROM XM-1502BN 1x 4x IDE 527> TOSHIBA CD-ROM XM-5302TA 1x 4x IDE 528> TOSHIBA CD-ROM XM-5401TA 1x 4x SCSI 529> TOSHIBA CD-ROM XM-5402TA 1x 4x IDE 530> TOSHIBA CD-ROM XM-1502B 1x 4x IDE 531> TOSHIBA CD-ROM XM-3501TA 1x 4x SCSI 532> TOSHIBA CD-ROM XM-5301TA 1x 4x SCSI 533> TOSHIBA CD-ROM XM-5201TA 1x 2x SCSI 534 535known cdda uncapable drives 536=========================== 537 538Pioneer DRM-602X, DRM-604X 539Teac CD-55A (panasonic bus) 540Philips CM206/10 serial RS-422 541 CM207 542 CM226/10 serial RS-422 543 CDD462/01 serial RS-422 544Orchid CDS3110 545 546Additions to the tables above are welcome. 547 548and now catch your sounds, 549Heiko heiko@colossus.escape.de 550