Jaques Law Office

My Struggles With Audio CDs

© 1999 Kevin Jaques. All rights reserved excepting that this file may be copied for non-commercial purposes, unchanged. No warranties apply. I am just a user volunteering my observations and collecting those of others.
 

Table of Contents

Audio CDs and the Finder

Audio CDs and the Control Strip

Audio CDs and Apple CD AudioPlayer

Audio CDs and CD Remote Programs ('CDRPs')

Audio CDs and the Magic Number

Audio CDs and the Internet CD Database (cddb)

Other Editors

Interapplication Cooperation

Custom Databases

Audio CDs and AppleScript

Using My 'Albums' and 'Tracks' Filemaker Database

Summary

Sorry, that's all the time I have.

This Jaques Law Bits was delivered by:

This Jaques Law Bits was prepared for:

Audio CDs and the Finder

If you mount an audio cd on the Mac, it will appear as a regular desktop volume icon, and its name will be "audio cd n".  "n" will be 1 for the 1st disk, 2 for the second, and so forth. Or, if you like, the ordinal number of audio cds mounted since startup.

You can't rename the disk.

You can open the volume to display the 'files'. Each file will be called 'track n'.  The file type is 'trak' and the file creator is 'aucd'. Interestingly, the comments will contain the play-length of the track.

You can't rename the track files.

I'm pretty sure Finder or the system can play the tracks, but if you open a track, it will run 'Apple CD Player' or whatever other application has been set up to handle that type of file.

It is usually invisible to the user, but something has to tell the system that the sound input will be coming from the CD drive for a time.

Playing an audio CD uses independent circuitry. Hence, playing an audio cd doesn't slow down your computer in the slightest. I played a demanding demo of Tomb Raider II, which was playing stereo sound at full capacity, at the very same time that stereo sound was playing from the cd. The computer had no difficulty mixing them.

Both data and resource fork supposedly have zero bytes. So the Finder won't copy them. Worse, it pretends to copy them, giving you a file of zero size. I am sure this is despicable copy protection. However, various utilities are available to convert a track to an AIFF format, including CDToAIFF (v1.2c is the latest version I know) or SoundApp. The resulting file will be around 30-40 mbytes! But you can turn it into MP3 format using a combination of SoundEditô16 SWA Xtras and MP3 Encoder. The conversion is slow, taking at least 13 minutes on my PB3400. The resulting file was still pretty big, about 3.8 mb, down from 33mb. MP3 seems to be emerging as the next big sound file format. It is supposedly cd quality at less than 1/10 the size.

Audio CDs and the Control Strip

CD Strip comes from Apple. Version 1.2.1  comes with system 8.1. It is a pull down menu with 4 sections: the CD's name, the CD play mode (normal, repeat, autoplay), the CD controls (play/pause, skip track, back track, stop, eject), and the list of tracks. If you select a track, it will play that track.

It's unobtrusive and efficient, and can be summoned instantly with a keystroke (summon/dismiss the control stip with the hot key you set in the Control Strip Control Panel).

But it won't name the disk or the tracks, or permit any data entering for that matter. But, if the disk and tracks have been named, it will use those names!
 

Audio CDs and Apple CD AudioPlayer

Apple CD AudioPlayer comes from Apple. Version 2.0  came with system 8.0. I think it used to be called "CD Remote".

So far as controlling the CD, it does everything the control strip will do, but in a much prettier package. The display shows track lengths. You can shrink or expand the display and choose a truncated version.

It does offer three additional functions.

The first is CD volume. This is a tricky one. Even though the sound volume may be on, the CD volume may be off. Often after my powerbook sleeps, the CD will seem to be malfunctioning, but I have learned that a quick trip to the Apple CD AudioPlayer to turn up the CD volume will fix it up.

The second additional function is related to program order. You can hit 'shuffle' and it will play the CD in random order. 'Program' will split the window into two vertical panes. You can then drag tracks from the left to the right to set a custom play order.

The third, and greatest, additional function, is that you can name the tracks and the disk.

Audio CDs and CD Remote Programs ('CDRPs')


I am told that pc computers offer comparable functionality to this point, at least to AudioPlayer. But they don't remember the disk/track names from session to session, and they aren't available to other cd-player applications.

Apple puts a simple little file in the Preferences folder, called "CD Remote Programs". The format is not difficult to obtain. Apple Technote DV-25 sets it out, and is attached. The basic scheme is that all data is stored in resources, with nothing in the data fork. For each CD that has been entered into the database, a resource of type `ProG' and a resource of type `STR#' are kept. There is only one `IndX' resource, number 128, in the "CD Remote Programs" file.  The number of the `ProG' and `STR#' resource are the same number for each CD. This number is generated by a call to Unique1ID.

I include a file containing a template resource. Use resedit to open the file. Copy the template resource. Open ResEdit's own prefs file with ResEdit. Paste the template. Now ResEdit will be able to make sense of the 'IndX' type of resource used by CD Remote Programs ("CDRPs")
 

Audio CDs and the 'Magic Number'

The cool thing about CDRPs  is that any other utilities or players can use the information from CDRPs immediately. It is a delight to see the track names in CD Strip even while AudioPlayer is still running. But how do they know which record matches the current CD? Well, there is an algorithm to calculate a 'magic number', based upon, in large part, the number and lengths of the tracks. That magic number is almost certain to be unique to each audio cd, so it is used to identify cds, and match the current CD to the appropriate record in CDRPs.

So, even between sessions, if you insert a previously catalogued CD, all the CD utilities that use CDRPs will 'remember' its name and track names.

The algorithm is described in cddb_howto.txt.

Audio CDs and Internet CDDB (CD Database)

Who wants to type all the track and disk names? There is an internet site called the CDDB. It is, duh, a db (database) of CDs. If you go to it, you can manually search for songs or CDs, and get a nice list. But more usefully, it publishes a specification (described in the same cddb_howto.txt) for how you can write a program to call for information. That program can then calculate the magic number, call CDDB, and fill in CD Remote Programs data.

CDDB has a page on its site setting out descriptions and sources of various programs that will perform this task. For the mac, I have tried NetCD and InCDius. Both operate as player/editors too.  I prefer InCDius. NetCD won't export.

This is a good summary of the cddb.

So, you connect to the internet. You shove in a cd. You run the program. You hit the command to look up the cd. It fills in the track and disk names. You tell it to save to CDRPs. You've got the data forever. Sweet.

InCDius and cddb permit you to submit a cd which isn't listed. I did find some omissions, even though the db far exceeded my expectations, finding entries for even the most obscure and detestable cd from my mother's collection. It shouldn't need to be said, but don't submit lists for your custom cds, since nobody else will have them.

Subscribe to CDDB announcements.

Other Editors

There are other editors that permit you to enter the track and disk names. CD MacEdit (the latest version I know is 1.5.1) does so.

Believe it or not, neither Apple Audio CD Player nor CD MacEdit permit you to export. A simple utility called CD Lister does that for you. Non-shareware programs will, and so does CD Coyote.

InCDius is a combination player and editor and will export the current cd, using a call to an applescript applet that you can alter to suit yourself.

But believe it or not, none of those four allow you to export or edit any cd other than the currently inserted cd.

CD Coyote (the latest version I know is 2.1.1) allows you to select an offline cd that has been entered to the CDRPs database. Without question, it is the best editor/player, but you can't throw out InCDius due to its abilities with the CDDB.

Oddly, I found none that were applescriptable.

Summaries follow:

AppleCD Audio Player
 shows tracks and times from "CDRPs"
 no applescript dictionary

FWB CDT Remote
 shows & edits tracks and times from "CDRPs"
 will export/import 'programs' in same resource fork format as "CDRPs"
 will copy AIFF file to disk
 no applescript dictionary

InCDius ->
 interfaces to CDDB
 allows submissions to CDDB
 allows editing CD name/tracks.
 Updates "CDRPs"
 cannot select CD which is not inserted
 cannot search for CD
 cannot export more than 1 CD at a time
 will export to script. You can write the Applescript fctn so it will send whatever you like to whereever you like
 java source code is available!
 no applescript dictionary

NetCD
 interfaces to CDDB.
 can copy the CD name/tracks to paste -> doesn't include track lengths, etc.
 can't copy more than 1 CD at a time
 no applescript dictionary

CD MacEdit
 can edit and export what is in "CDRPs"
 but only 1/time until you pay
 doesn't include track times, etc.
 no applescript dictionary

TitleTrack
 seems like a decent db, aware of internet CDDB but max 5 CDs till you pay
 didn't download

OmniCD
 only for MacOS X
 didn't download

AudioFile Internet Companion
 seems like a decent or even good db but max 5 CDs or something till you pay. 1 mb download
 didn't download

CD Lister
spews a text version of CDRPs.

MacCDDB
queries the CDDB database and updates CDRPs

CD Coyote
edit current or chosen CD info in CDRPs
export (customizable)
merge two files of CDRP format!
sort disks in CDRPs
find by track or by disk
CD Player
And hey! CD Coyote is still FREE!
 

Interapplication Cooperation

Interestingly, you can control the CD with several utilities at the same time. You could have AudioPlayer, and InCDius, and CD Strip, and applescript or appleevent using applications all open concurrently, and they could all display and control the CD. I understand that pc computers can't match this.

Custom Databases

The only application so far discussed which will allow you to search for a song from your data is CD Coyote. Of course the cddb lets you do so. But so far as customizing the display, selecting a subset of tracks, or various annotations such as quality, artist, track length, descriptions, there is nothing. Any database program would permit it, but how do you get the data there?

InCDius comes with  an applescript applet, and an applescript osax and "Music Database" by Omar Shahine. InCDius offers to "save to applescript". By that it means that rather than saving to CDRPs on a particular occasion, it will call the applescript applet, which uses calls to the OSAX (Open Scripting Architecture eXtension). You edit the applet with Script Editor (from Apple) or some other AppleScript or text Editor to take the appropriate steps to get the data to your desired application. It comes pre-configured to send data to Music Database.

I was unsatisfied with how Music Database uses included lists to keep track of tracks. You can search for a cd by a track and display and sort the tracks, but you can't create a subset of tracks. And since, for the purpose of recording custom compilations, you must be track oriented, it failed for my purposes. But it looked great and was a useful demo of applescripting audio cds. So I used it as a template for my 'Albums' Filemaker file, which is linked to my 'tracks' Filemaker file.

Unfortunately, by divorcing the 'tracks' to a separate file, the pre-configuration of the applet which interfaces to InCDius no longer works. And I haven't fixed it (yet). Instead, I rely on two approaches. First, to get in all the cds to date, I export them, then use my Excel 3 parsing utilties, CD List Analyzer.xl and CD List Exporter.xl, which breaks up song and artist where appropriate, and assigns record numbers to the CDs, and so forth. Specifically:

  • paste the resulting text table columns into the origcolA and origcolB fields in my parser utility, CD List Analyzer.xl, an Excel 3 file.
  • Fill the calculations down to the bottom of the data.
  • Set the database to include the bottom of the data.
  • Set the desired first album record number.
  • See if it needs any touch-ups.
  • Open CD List Exporter.xl
  • Set the data in the criteria as directed for albums
  • Extract
  • 'Save as' to a text file of another name, like temp.albums.txt
  • Set the data in the criteria as directed for tracks
  • Extract
  • 'Save as' to a text file of another name, like temp.tracks.txt
  • Switch to Filemaker
  • Ensure 'Albums' file is open and forefront.
  • Import
  • Ensure 'Tracks' file is open and forefront
  • Import
  • Then I use my Excel 3 file, "CD List Exporter.xl" to extract first the albums, which I save to text then mport to the Filemaker file, "Albums", then do the same for the tracks.

    Then, to add new cds, I shove them in, use InCDius to set the data in CDRP, then use applescript commands and scripts in the Filemaker files to set data to the current cds. Incidentally, although it doesn't store it, the system knows the lengths of all the tracks in the current cd.

    Audio CDs and Applescript

    As you know, the MacOS supports (offers) Open Scripting Architecture. And Apple includes AppleScript, a language for that architecture, and Script Editor, to edit that language, with the MacOS. One thing that makes it 'open' is the ability to add extensions, which are called OSAXen. A single extension is an OSAX, which stands for "Open Scripting Architecture eXtension".

    Glenn Howes has written such an OSAX for audio cds, called AudioCDgh. The latest version is 1.1.3b3. It offers good control of the audiocd and can deliver all the data known by the system about the audio cd. In fact, I think I have given my custom database fairly credible 'player' functions using it. Unfortunately, 'stop' doesn't work, but 'pause' does, so it's ok. To install it, drag it to your system folder. It should wind up in the Scripting Additions folder.

    One beautiful thing about OSAX  is that they are supposed to include a 'dictionary'. AudioCDgh does. You run Apple's Script Editor, command it to 'open dictionary', select AudioCDgh, and you get a somewhat readable explanation for how to make the calls. You must be somewhat familiar with the Object-Oriented scheme of objects, properties, and events.

    Applescript reads beautifully. Usually a complete novice can read a typical Applescript line and understand completely what it is to do. That is so misleading. Just because the effective line is good english, doesn't mean that using good english makes an effective line. Writing it is a bugger. I'm sure it isn't Glenn Howes' fault, but here are some annoying examples.
     

     You can't just say "get play status of information of audio cd". You must say "get play state of (cd information)". So you would think you would say "get disc mins of (cd status). Nope. You say "get disc mins of status of audio cd".

    And check this out.

    So far as I know, 'get' is just the same as saying 'set the result to'. In corroboration, these both work:
     set the clipboard to (mins of (track information for audio cd for track 3)) as text
     get  (mins of (track information for audio cd for track 3)) as text
    But while this works:
     get audio cd title for track 2
    This doesn't:
     set the clipboard to audio cd title for track 2
    Nor does it work by adding 'as text' to the end.

    The answer? Believe it or not, you do a set to a get, as follows:

     set the clipboard to (get audio cd title for track 1)
    One glaring gap is the inability to set track/disk names with Applescript, unless I am missing something.

    Using My 'Albums' and 'Tracks' Filemaker database

    As I indicated above, you can use an export from CDRPs, parsed by my two Excel files, then imported into Albums and Tracks.

    Open Albums. It will show the related tracks from the 'Tracks' file for any selected cd record. Use it like any other Filemaker file. It's CD-Player functions are self-evident. Try out the scripts and buttons. But here is the basic procedure for editing/creating a cd.

  • Open Albums
  • Choose layout 'input'.
  • Hit 'Display Current CD'. If it can't find the current CD, it will ask if you want to make a new record. If CDRPs already has the track/disk info, then you do. If it creates a record, It will fill in all the available data. If not, it will find all the CD records.
  • If the current CD is found, but the record has omissions, ensure CDRPs has all the available data by:
  • check with CDStrip
  • set with InCDius and internet cddb
  • If the current CD was found, but the record doesn't have:
  • all the tracks - manually make records for tracks. You can use scripts to fill them in. Or delete all the existing tracks, copy the album record number, go to the Tracks file, and run the script to create track records.
  • track lengths - hit the 'tracks' button. Run script to set track lengths. Hit the 'albums' button to return.
  • track names - hit the 'tracks' button. Run script to set titles to any tracks with nothing in the 'title' field.
  • disk info - hit 'set blank data to current' button
  • Apply Parsers?
  • Sometimes the disk or track name contains other information besides the title, such as artist, composer, etc. If it forms a regular pattern, you may be able to use a 'replace' with calculation command to set those fields. Some common algorithms are already available as scripts. Some of these may be in the 'Tracks' file.
  • Use them with skill and caution, and with a backup. There is no 'undo' to a replace in Filemaker.
  • Annotate and evaluate the disk and the tracks.
  • Summary

    I recommend the following, for the following uses:
  • Play and control CDs - Apple's control strip, "CD Strip"
  • Download and edit track info - InCDius
  • Edit and export track info - CD Coyote
  • Massage exported data for import - my XL files, "CD List Analyzer.xl" and "CD List Exporter.xl"

  • Music
  • Annotate, search and select - my Filemaker files "Albums" (based on "Music Database" by Omar Shahine) and "Tracks"
  • The obvious goal in future development for audio cds for the mac is the integration of these functions. But beware, the annotation must be extremely flexible or it will be useless.

    Available indexes of other recording media such as vinyl or cassette should be offered.

    Songs and performances and tracks should be distinguished, since a good song might have good or bad versions, which might have good or bad recordings.

    Attached Files

    CD Strip
    AppleCD Audio Player
    CD Remote programs.fmt.html (Apple Technote DV-25)
    cddb_howto.txt
    'IndX' TMPL for CD Remote Programs
    AudioCDgh.v.1.1.3b3
    CD Coyote 2.1.1 Folder
    CD-ROM Driver.Technote.html
    CDDB Technical Info.html
    CDToAIFF v1.2c É
    InCDius GH 1.1 Folder
    CD List Analyzer.xl
    CD List Exporter.xl
    Albums
    Tracks
     

    Sorry, that's all the time I have.


    This Jaques Law Bits was delivered by:

     
    Kevin Jaques, B.A. LL.B.
    of the
    Jaques Law Office
    1542 Albert Street
    Tel: (306) 359-3041
    Regina, Saskatchewan
    Fax: (306) 525-4173
    Canada, S4P 2S4
    Home: (306) 586-2234
    email: jaques.law@dlcwest.com 
    Remember, like any other form of communication, email may be intercepted.

    Please visit our Web Site

     
    Homepage
    Experience
    Biography
    Retain


    This Jaques Law Bits was prepared for:

    The MacIntosh User's Group of Regina Saskatchewan

    Text Based Page
    Fancy Page