audiotools.cdio — the CD Input/Output Module

The audiotools.cdio module contains the CDDAReader class for accessing raw CDDA data.

CDDAReader Objects

class audiotools.cdio.CDDAReader(device[, perform_logging])

A audiotools.PCMReader object which treats the CD audio as a single continuous stream of audio data. device may be a physical CD device (like /dev/cdrom) or a CD image file (like CDImage.cue). If perform_logging is indicated and device is a physical drive, reads will perform logging.

CDDAReader.sample_rate

The sample rate of this stream, always 44100.

CDDAReader.channels

The channel count of this stream, always 2.

CDDAReader.channel_mask

This channel mask of this stream, always 3.

CDDAReader.bits_per_sample

The bits-per-sample of this stream, always 16.

CDDAReader.read(pcm_frames)

Try to read a pcm.FrameList object with the given number of PCM frames, if possible. This method will return sector-aligned chunks of data, each divisible by 588 frames. Once the end of the CD is reached, subsequent calls will return empty FrameLists.

May raise IOError if a problem occurs reading the CD.

CDDAReader.seek(pcm_frames)

Try to seek to the given absolute position on the disc as a PCM frame value. Returns the position actually reached as a PCM frame value. This method will always seek to a sector-aligned position, each divisible by 588 frames.

CDDAReader.close()

Closes the stream for further reading. Subsequent calls to CDDAReader.read() and CDDAReader.seek() will raise ValueError.

CDDAReader.is_cd_image

Whether the disc is a physical device or CD image. This is useful for determining whether disc read offset should be applied.

CDDAReader.first_sector

The first sector of the disc as an integer. This is mostly for calculating disc IDs for various lookup services.

CDDAReader.last_sector

The last sector of the disc as an integer.

CDDAReader.track_lengths

A dict whose keys are track numbers and whose values are the lengths of those tracks in PCM frames.

CDDAReader.track_offsets

A disc whose keys are track numbers and whose values are the offsets of those tracks in PCM frames.

CDDAReader.set_speed(speed)

Sets the reading speed of the drive to the given integer. This has no effect on CD images.

CDDAReader.log()

Returns the read log as a dictionary. If logging is active, these values will be updated on each call to CDDAReader.read(). If logging is inactive or not supported, all values will be 0.

CDDAReader.reset_log()

Resets all log values to 0. This is useful if one wants to get the log values for many tracks individually.

Table Of Contents

Previous topic

audiotools.replaygain — the ReplayGain Calculation Module

Next topic

audiotools.dvda — the DVD-Audio Input/Output Module

This Page