PyAudioCD for Linux

1 Introduction

This documents describes the Python module cdrom_lnx. This is a thin layer around the basic Linux IOCTL calls to control an audio CD player. Up to now, it has only been tested under Linux 2.0.36 with an IDE-CD player. According to the Linux documentation, it should however work with other CD types, too. Currently, no SCSI commands are used, even though some calls may be supported by non SCSI-CDs.

2 Module Content

2.1 class CDRom

represents an open CDRom device. It supports the following methods:
__init__(devicename)
opens the device devicename (for read only access).
pause(), resume(), start(), stop(), eject(), closeTray(), reset()
do what their name tell.
readToc()
reads the CD's table of contents.
The result is a list of TocEntries (more precisely cdrom_tocentry instances). The entries have an additional member duration which represents the duration of the track in frames (i.e. 1/75 s).
playFRAMES(startframes,no)
plays no frames starting with startframes.
playTI(starttrack,startindex,endtrack,endindex)
plays from starttrack,startindex through endtrack,endindex (inclusive).
playMSF(startminute,startsecond,startframe, endminute,endsecond,endframe)
plays from startminute,startsecond,startframe through endminute,endsecond,endframe.
setVolume(channel0,channel1,channel2,channel3)
sets the volume for the 4 channels.
setVolume can be called with a single cdrom_volctrl instance argument, instead.
getVolume()
returns a cdrom_volctrl instance, an object with members channel0,channel1,channel2,channel3.

2.2 class cdrom_tocentry

describes a CD track. It supports the following methods:
isDataTrack()
the track contains data rather than audio information.
getLBA()
the LBA (= logical block address, i.e. frame address) address where the track starts.
getMSF()
the MSF (= minute/second/frame) address where the track starts as a cdrom_msf0 instance, an object with members minute, second and frame.
cdrom_tocentry instances returned by CDRom.getToc have an additional member duration that specifies the track's duration in frames.

2.3 function lba2msf(lba)

converts from LBA (logical block address) to MSF (minute/second/frame), a cdrom_msf0 instance.

2.4 function msf2lba(minute,second,frame)

converts from MSF (minute/second/frame) to LBA (logical block address).
msf2lba may also be called with a single cdrom_msf0 argument.
Dieter Maurer
Last modified: Fri May 5 22:16:45 CEST 2000