Short: Play and save digital audio Author: mlelstv@serpens.swb.de Uploader: mlelstv serpens swb de Type: disk/cdrom Architecture: m68k-amigaos Read audio data from a CD-DA disk (normal audio CDs) and play back via audio.device (22kHz) and store to outputfile either in 16bit, stereo, 44.1kHz AIFF or in 8bit, mono or stereo, 22.05kHz 8SVX. usage: cdda START,LENGTH,TRACK/N,VOL=VOLUME/N,FILE,8SVX/S,MAUD/S,WAV/S,16BIT/S, MONO/S,MUTE/S,LIST/S,DEBUG/S,BUFS/N,QLEN/N,PLAN,TMP,NOFILTER/S: START = startblock LENGTH = number of blocks TRACK = start relativ to track number VOL = volume in percent (0..800) FILE = file to save to 8SVX = use 8SVX format instead of AIFF MAUD = use MAUD format instead of AIFF WAV = use WAV format instead of AIFF (disables audio) 16BIT = experimental high resolution mode for audio output MONO = map stereo to single channel and write mono 8SVX MUTE = disable audio output completely LIST = show table of contents DEBUG = print lots of debugging info through debug.lib (use sushi!) BUFS = number of CD blocks to do in a single read.. default is 8. QLEN = length of CD-ROM input queue, default is 16. PLAN = method to access the CD-ROM, current plans are 'a','b' and 'c' 'a' is for Sony CDU 8003 and compatible 'b' is for Toshiba XM3401TA and compatible 'c' is for NEC 2X and 3X 'd' is for some Grundig CD-ROMs, may work on Toshiba drives 'e' is for ATAPI (standard command) 'f' is for ATAPI (pre-standard command, never seen such a drive) the program detects some drives itself but you can force it to use a specific plan with that option TMP = temporary file to store second channel in 8SVX mode. NOFILTER = when downsampling to 22kHz audio, don't filter. Reduces CPU usage a little. You can use the environment variables CDDA_DEVICE and CDDA_UNIT to choose something else than the default ("scsi.device" and 2). To accomodate for older device drivers you can ask for a specific memory type used for all SCSI-direct buffers. This is done with the environment variable CDDA_BUFMEMTYPE. A value of 2 asks for chip memory, a value of 512 asks for memory reachable by Zorro-2 DMA controllers. Even for controllers that do not need a specific memory type it might show better performance. There's a tiny program called 'led' in the archive which toggles the audio lowpass filter on newer machines. Disabling the lowpass filter will usually get better audio quality but may cause aliasing distortion depending on the bandwidth of your speakers. Version 1.11 and newer of this program no longer saves data in RAW format. Instead it writes an AIFF header so that other programs can easily identify the data. If you select the 8SVX switch then cdda will write in IFF 8SVX format instead. Version 1.24 and newer can also write the MAUD format used by software for the Toccata 16bit audio card. 8SVX output is affected by the VOL and MONO setting so that you can scale the output for maximum dynamic range within the 8 bits of 8SVX, you can also select either mono or stereo output. 8SVX samples are reduced to a sample rate of 22050Hz for easy play back with any Amiga 8SVX player. Actually you get exactly what you hear from cdda. Neither AIFF, MAUD nor WAV output is affected by these settings, they always save the full 16bit data. Saving in 8SVX stereo has a slight problem since 8SVX saves each channel in a contigous part of the file. cdda will alternate between both channels which causes lots of head movement and is therefore much slower.. usually too slow for a smooth audio output. I suggest to MUTE audio when saving 8SVX stereo files. Another point. Seeking in large files requires reading of 'extension blocks' which point to the actual data. There can be lots of extension blocks for large files which are best cached in RAM with the ADDBUFFERS command. The typical 30Megabyte file for a song needs about 900 buffers on partitions with 512 byte per block. Another solution is to create a harddisk partition with larger blocks (possible with the ROM filesystem from AmigaOS 3.1) which can reduce the need for extension blocks a lot (with 2048 byte/block you just need 36 extension blocks for the 30Megabyte file). If you have 2 disks or a large RAM disk you can use the TMP option to circumvent the problems with stereo 8SVX. cdda will store the data from the right channel into the file passed with the TMP option. When all data has been recorded it will append this data to the real output file and delete the temporary afterwards. If you put the TMP file on the same physical disk as the output file this might result in even heavier disk activity than when using a single file, it saves you from having tons of buffers though since no seeking is done within a file. Version 1.37 supports the NEC 3X (and possibly NEC 2X) CD-ROM drives which have two problems. First, any command send to the drive while reading audio data disrupts the data stream _without any notice or error condition_. Then audio data is definitely lost, and if an odd number of bytes is lost the byte order of the data gets changed and the result is lots noise. I haven't found any possibility to detect such a condition or to prevent other programs from sending commands. Unfortunately this also includes most CD-ROM filesystems or SCSI drivers that poll the unit for disk changes. Second, the NEC 3X does not disconnect from the bus while reading audio data (it does normally when reading CD-ROM disks). That's why this version of cdda allows finer control of the queuing parameters. Previously you could set the size of the I/O buffers with the BUFS parameter (in units of CDDA blocks). Now you can also change the length of the input queue which is the number of I/O buffers used for the CD-ROM. The total buffer size is therefore BUFS * QLEN * 2352 Bytes or BUFS * QLEN / 75 seconds. Small buffers improve throughput on the SCSI bus (the NEC 3X doesn't like BUFS=1 though) but increase CPU load. Version 1.40 fixes a few bugs in 1.37. Version 1.50 adds some compatibility code. It also fixes the problem with reading the end of the CD. The reader code always tried to read BUFS blocks even when this extended the read beyond the end of the disk. This results in "No more data" messages on drives that do not return partial blocks in this case. Version 1.51 handles the "no seek complete" message. Version 1.53 detects Pioneer DR-* and DRM* CD-ROM as compatible with PLAN a. Version 1.54 recompile with latest SAS/C Version 1.55 experimental code for IDE drives and drivers that send ATAPI commands transparently (PLAN e and f for ATAPI and a former proprietary command). A test with IDEfix crashes the machine though. Version 1.57 fixed a bug in ATAPI support, now plays a few seconds and then crashes. Could be an Idefix bug. Version 1.60 added WAV file output, this will automatically mute audio because the data isn't byteswapped for WAV (the audio routines need bytes swapping). Version 1.64 enabled BUFS for ATAPI. Seems to work stable together with atapi.device 118.3 and idefix.library 99.1. Michael van Elst