audiotools.toc — the TOC File Parsing Module

The audiotools.toc module contains the TOCFile class used for parsing and building TOC files representing CD images.


Takes a filename string and returns a new TOCFile object. Raises TOCException if some error occurs when reading the file.

exception audiotools.toc.TOCException

A subclass of audiotools.SheetException raised when some parsing or reading error occurs when reading a TOC file.

TOCFile Objects

class audiotools.toc.TOCFile

This class is used to represent a .toc file. It is not meant to be instantiated directly but returned from the read_tocfile() function.


Returns the TOC file’s catalog number as a plain string, or None if the TOC file contains no catalog number.


Returns an iterator of index lists. Each index is a tuple of CD sectors corresponding to a track’s offset on disk.

TOCFile.pcm_lengths(total_length, sample_rate)

Takes the total length of the entire CD, in PCM frames, and the sample rate of the stream, in Hz. Returns a list of PCM frame lengths for all audio tracks within the TOC file. This list of lengths can be used to split a single CD image file into several individual tracks.


Returns a dictionary of track_number -> ISRC values for all tracks whose ISRC value is not empty.

classmethod TOCFile.file(sheet, filename)

Takes a cue.Cuesheet-compatible object with catalog(), indexes(), ISRCs() methods along with a filename string. Returns a new TOCFile object. This is used to convert other sort of Cuesheet-like objects into actual TOC files.

Table Of Contents

Previous topic

audiotools.cue — the Cuesheet Parsing Module

Next topic

audiotools.ui — Reusable Python Audio Tools GUI Widgets

This Page