Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Accessing Audio CD Table of Contents

I'm trying to find a way to access the track table of contents, and index numbers, which are on conventional audio CDs. The TOC of an audio CD gives the total playing time of the CD, the number of tracks, a "frame offset" for each track from which the playing times of tracks can be computed, and a flag which tells whether a track is audio or some other kind of data. In addition, every "frame" on an audio CD (1/75th of a second of audio) has a tiny block of data called a "q-subchannel" which contains track and index numbers. (Index numbers are an extremely rarely used feature of the audio CD standard, originally intended to mark separate passages within classical music tracks, but they are also used more commonly to mark the pauses between audio tracks. Most inexpensive CD players these days don't even bother with them.)

I thought I had found a shareware "scripting additon" file that would enable me to capture this data. It is called audioCDgh, and can be found at a number of sites, but it was written about 1999 for OS 9, and I haven't been able to find a way to make the Tiger Applescript editor recognize it. I've already contacted the developer, asking if he had an OS X version, but he doesn't.

Is there any way to make an OS 9 scripting addition file work under OS X? Or, as an alternative, does anyone know of another scripting addition, or of some scriptable application program, that would provide access to the same data? Or any other strategy?

Thanks

Dual 1.2 GHz, Mac OS X (10.4.10)

Posted on Aug 5, 2007 8:34 PM

Reply
5 replies

Aug 7, 2007 6:11 AM in response to red_menace

Well, ok....

I have a large number of audio CDs, over a thousand, collected over the past 27 years, and I was thinking of building a specialized index/database of their tracks in an xml application, the format of which I'm still cooking up. I'd like to be able to include as much data about disc structure as I can. What little information I've found about audio CDs suggests that they are astonishingly primitive data structures: there really isn't anything like a true file structure on them which, given that these things are made to a standard from around 1980, I suppose I should have guessed.

The problem is that the information on audio CD data structures is kept in something called "The Red Book," which seems to be Top Secret. Actually, you can get a copy on the web, but even a PDF version will set you back a couple hundred bucks. Why this should be for such an old standard, and one that I would think would be to the industry's advantage to have known as widely as possible, is a great mystery to me.

I had looked at the iTunes dictionary, and seen that I can get number of tracks, and also track lengths, but it looks like the track lengths are rounded or truncated to an integer number of seconds. From what little information I've been able to glean from various sources, track lengths are actually in multiples of 1/75th of a second: the "offsets" in the TOC are actually three byte pointers in the form mm:ss.ff, where each byte is two BCD digits, ss running from 00 to 59, and the "frame" ff running from 00 to 74.

With this information, I could compute track times to 1/75th of a second. What can I say? I'm a precision freak.

But this isn't actually enough information, because with the exception of a few so-called "gapless" discs, all my CDs have pauses of 1 to 5 seconds between tracks. These gaps are, I think (again I'm infering from inadequate information), identified by an "index zero" mark in the actual frames. If you've ever watched the counter on a CD player, you may have noted that the counter counts downward in negative numbers between tracks. I'm pretty sure this is just the traditional way CD players deal with index zero frames, and to get the true time of a track, you have to subtract these from the offset differences which you could get from the TOC -- if you could get to the TOC. I'd like to be able to experiment to check this hypothesis.

Also, I do have a few rare CDs that actually make other use of index numbers. One in particular is very odd: it's Glenn Goulds' performance of the Goldberg Variations, and the various variations are identified by index numbers rather than track numbers. There's only one track on the disc, which makes playing it very awkward, and I've never known whether this was done deliberately or whether it was some kind of mistake.

Do you know if some high-end CD manipulating program, like Roxio Toast, is (a) AppleScriptable, and (b) allows access to this low-level data? I hate to buy a program just to have a look in the dictionary.

Thanks

Aug 7, 2007 10:03 AM in response to Jeff Johnson 1

Hello Jeff Johnson,

A few things.

• If your CD drive is actually a sort of disc writer/bunner, I think you may try drutil(1) via 'do shell script' in AppleScript. Not tested though, for I don't use OSX for myself.

Something like this (in Terminal) -

drutil -drive 'XXXX' toc
drutil -drive 'XXXX' trackinfo -xml
drutil -drive 'XXXX' discinfo -xml

('XXXX' is a drive identifier you can get from the output of 'drutil list' command.)

And in AppleScript -

do shell script "drutil -drive 'XXXX' toc"
do shell script "drutil -drive 'XXXX' trackinfo -xml"
do shell script "drutil -drive 'XXXX' discinfo -xml"

cf.
drutil(1)

'do shell script'
http://developer.apple.com/technotes/tn2002/tn2065.html



• Scripting additions written for OS9 can only be used in Classic under OSX. Probably you may use 'Script Editor' in Classic environment to write your script which uses 'AudioCDgh' OSAX and save it as a Classic application, which should run in Classic under OSX.



• The Red Book (CD-DA spec.) is not free but you can get a free official document which practically covers the Yellow Book (CD-ROM spec.). CD-ROM is an extension to CD-DA and actually the same as CD-DA in many aspects, except for, e.g., new Sync/Header in Sector format, enhanced error correction features etc.

Here's the link.
http://www.ecma-international.org/publications/standards/Ecma-130.htm



• Yes, the CD of GG's Goldberg Variations released in1982 consists of one track with 32 indices and only high-grade CD players let us choose the variation to play! However, the remastered CD released as one of The Glenn Gould Edition in1993 has 32 tracks. Also the remastered disc does not have a particular noise due to defect in CD press in the12th variation in the original release. If you do not have the latter one, I'd recommend it. ;- )



Hope this may be of some help,
H



Message was edited by: Hiroto

Aug 8, 2007 12:45 AM in response to Hiroto

The various options you give for drutil work perfectly. And there is one other:

drutil -drive 'XXXX' subchannel

which produces a list of index marks, and a few other things (MCN and ISRCs, not that I've found a disc yet that actually has these). It takes the subchannel option a few minutes to run, but then it has to scan the entire disc.

It looks like drutil can get me everything I wanted. And I will look for that remastered Glenn Gould CD.

Thank you!

Accessing Audio CD Table of Contents

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.