MacDevCenter    
 Published on MacDevCenter (http://www.macdevcenter.com/)
 See this if you're having trouble printing code examples


Digital Bookmark Mods

by Matthew Russell
03/15/2006

If you're anything like me, you own your fair share of digital audio, whether it's from the iTunes Music Store, ripped CDs, podcast downloads, or your own audio notes. And if you're anything like everyone else in the world, you probably spend a lot more time listening to it than organizing and modding it. Well, that might just change after delving into the world of digital bookmarks. In this article, I'll show you how to add better bookmarks to your audio books, add slideshows to your music files, create enhanced podcasts, and share your favorite mods with others--even if they're on protected audio. Interested? Let's get started.

Bookmarks

Unless you have a totally amazing memory, you probably use bookmarks more than you realize. Keeping track of important web pages, remembering where you left off in the book you're reading, and dog-earing the coolest projects in the latest issue of MAKE are a few examples that come to mind. But with the latest wave of podcasting ushering in a whole new generation of digital audio, bookmarks are becoming just as important in that arena as well.

For example, consider audio books. Your typical iTMS audio book download comes in approximately two-hour segments that are each pre-bookmarked into hour-long halves. This setup is convenient for burning to CD, since most CDs are around an hour long, but it's not really convenient for anything else--including listening to or navigating through the track in any efficient manner.

A two-hour-long unbookmarked audio book

A nice two-hour-long audio book inconveniently bookmarked into two unmeaningful "chapters"

Rather, it would be much more convenient to have the book broken up into tracks that correspond to the actual chapter or section breaks in the printed book itself. Or you might prefer to have the audio book split into three-minute sections because you like to take notes and want to be able to easily review any given portion of the audio book, and that brings me to my next point: bookmarks are all about you--not someone else who's already decided what's convenient for you beforehand. Let's take a look at how bookmarking can put an end to this mess once and for all.

Apple's ChapterTool

Apple has made available a goodie (still in beta status as of this writing) called the ChapterTool. Download this disk image containing ChapterTool and place the enclosed folder somewhere convenient like your Applications folder. Once you've done that, copy the actual ChapterTool executable to a location in your path, such as /usr/bin/.

Now, go ahead and verify that ChapterTool is in your path by getting back a meaningful response with which ChapterTool in Terminal. Assuming everything checks out, go back and double-click on the audio file sample.m4a that's in the enclosed Sample folder to hear the sweet elevator music, courtesy of Cupertino. Note that the album artwork pane is empty.

Next, take a moment to carefully peruse the sample.xml file included with the sample. It's an XML file, but you should be able to understand most of it, even if XML is Greek to you, since it's thoroughly commented. Once you have a good handle on it, take a look at the same XML file without all of the commenting clutter:

<?xml version="1.0" encoding="utf-8"?>
<chapters version="1">
    <chapter starttime="00:00">
        <title>Introduction</title>
        <picture>pictures/PodcastLogo.png</picture>
        <link href="http://www.apple.com/">My Podcast Homepage</link>
    </chapter>

    <chapter starttime="00:08">
        <picture>pictures/PodcastMiddle.jpg</picture>
        <link href="http://www.apple.com/pr/bios/">My Biography Page</link>
    </chapter>

    <chapter starttime="00:15">
        <title>This is the End</title>
        <picture>pictures/PodcastEnd.jpg</picture>
        <link></link>
    </chapter>

    <chapter starttime="00:20">
        <title>No, Really.</title>
           </chapter>
</chapters>

Pretty simple, right? It specifies four different chapters, where each chapter has a title and, optionally, contains an image and a link.

Let's use the ChapterTool to add apply those edits contained in the XML file to the elevator-music sample track so you can see how easy it is to add bookmarks, pictures, and links to songs. Navigate to the ChapterTool/Samples folder in Terminal and type the following:

ChapterTool -x sample.xml -a sample.m4a -o output.m4a

Here, you're invoking ChapterTool and telling it to apply the edits in the sample.xml for the sample.m4a track and to produce the output.m4a track as a result. That's about all there is to it, but you can turn to ChapterTool/About Chapter Tool.rtf for more information.

To view the changes to the track, double-click output.m4a and it should automatically open and run in iTunes. In addition to the nice elevator music you heard before, you should see some images and hyperlinks in the artwork folder. Also note that the bookmarks button in iTunes contains thumbnails of your embedded images, and that if you were to burn the track to disk, it would split into tracks designated by the bookmarks.

Apple's sample bookmarkedA close look at the album artwork pane

Apple's sample after you modify it to have bookmarks with optional images and/or links

iPod & iTunes: The Missing Manual

Related Reading

iPod & iTunes: The Missing Manual
By J.D. Biersdorfer

Enhanced Podcasting and Presentations (Even Without iTunes)

One really cool thing about mp4 files is that they're not in a proprietary format; rather, they're based upon a published and well-known specification. Thus, any player that conforms to that spec should be able to play the file you just created. This is great for us, because it means we're not stuck with iTunes if we don't want to be. Instead, we can choose to listen to and view content in a more versatile player such as QuickTime, if the situation calls for it. Watching a montage, reviewing a presentation, or checking out a high-resolution enhanced podcast are a few examples of where QuickTime outshines iTunes. Until iTunes improves its viewing options, you can get a handy AppleScript that opens the current selection in QuickTime here.

Distributing Your Digital Media Mods

Apple's ChapterTool is simple and elegant, and it's allowed us to cover most everything you can do (for now) so far as digital bookmarking and creating enhanced podcasts goes. But what about distributing the mods you've made? You see, bookmarking is a lot like indexing; it's something that could be mechanical, but it's likely to turn out a lot better if you put some thought into it.

For example, there's no other way to bookmark an audio book into its chapters or sections without listening to it and making notes of where breaks occur. Trust me, this is a chore you wouldn't want to wish upon anyone--so why not share the fruit of your labor whenever you do have to take the time and drudge through it?

Or for another example, suppose you took some really cool pictures of at that last Coldplay concert you went to, and being the artistic genius you are, you've weaved together a sweet little montage for their entire X & Y album. "But wait a minute," you say. "I can't distribute those modified files, because that would violate DRM, and if I bought the tracks from the iTMS, someone else couldn't even play them anyway." Well, I concede your analysis so far, but what if you didn't distribute the actual audio files themselves? Instead, what if you cleverly decided to distribute only your XML and image files that you used to produce your fanciful little craft. Guess what? It would work, and you'd be able to stay legal.

Ideally, here's what would happen. You'd be perusing your music library in iTunes and say, "Hey, I really like this song. I wonder if someone has prepared any cool mods for it? I sure would like to see a cool slideshow." Then you'd take a look on some page that aggregates everyone's mods, find your song, and pick one of the mods that fits your bill, and "install" the mod (more to come in a moment on an "install" tool). Mods would, of course, be published with a descriptive summary and come in a standardized format.

In fact, this whole concept could actually be pretty simple if we all agreed to play by the same rules when creating our mods. Here are a few commandments that can keep us all on the same page and able to easily share:

Clearly, a much more industrial-strength solution would be desirable. An app to package and upload mods you want to share to some central repository semi-automatically, and a tailored mechanism involving RSS or Atom for subscribing to other people's mods, would be a good start. But since we don't have that kind of momentum (yet anyway), let's just be pragmatic, hack things the old-fashioned way, and simply use the discussion area below to share our mods. If things get hot, I'm sure someone will work up more robust solution, and if they don't, then I will.

Getting Your First Mod

Let's try this whole system out from the standpoint of someone looking for mods to install. Assuming you've placed the AppleScript "install" tool in your ~/Library/iTunes/Scripts folder, select an unmodified version of the "sample" track (or any other track for that matter), run the script, and when prompted, enter http://www.oreillynet.com/mac/2006/03/15/examples/elevatorMod.tar.gz. The mod is simply a set of images with corresponding links just like you've seen before. There's nothing new there. It's the whole utility of being able to download mods to arbitrary audio files that's so durn slick!

For my next trick, I've put together a series of mods for the audio book Freakonomics: a Rogue Economist Explores the Hidden Side of Everything (a very good read) that breaks the book into its actual chapters instead of the "one big pair of clown pants" approach. This audio book, as purchased on iTMS, comes as three big files with bookmarks around the hour markers. Clearly, a little more thought could have gone into the bookmarking--but at least we have the power to change that. Run each of the three mods to make the magic happen. Without further adieu:

Freakonomics Before Bookmarking

Before bookmarking

Freakonomics After Bookmarking

After bookmarking

Now, honestly--which one do you like better?

Making Life Easier with AudioBinder

AudioBinder Screenshot

AudioBinder can really save you some time if the ChapterTool makes its way to your list of frequently used apps.

If any of this "creating an XML file" business seems like too much work, I'd invite you to rest easy and take a look at the excellent wrapper available for Apple's ChapterTool called AudioBinder. It's basically a feature-rich GUI that allows you to visually specify your bookmark location and/or links and images to a file. In other words, this neat little tool is a huge time saver!

The lite version doesn't allow you to embed images or links, but you are able to try these features out on Apple's Sample.m4a file that comes with the ChapterTool to see how they work. In short, the lite version works just fine for plain audio bookmarking, but if you're into creating your own enhanced podcast, developing uneditable presentations without QT Pro, or anything else fairly sophisticated, however, the registered version may well be worth the small fee. The registered version also includes the ability to export the XML file that it generates behind the scenes, so if you decide to create and distribute digital audio mods as presented in this article, it may well be worth the registration fee for that reason alone. AudioBinder is actively being developed and improved, and according to the developer, a beta with more UI niceties and the ability to stitch together mp3 files is on its way soon.

Go Make Some Mods

As I continue to bookmark my digital audio library, I'll post the links to the mods in the discussion area below, and I invite you to do the same. If everyone who reads this were to chip in with a contribution, we'd start off with some serious momentum. If you have a mod you want to share but don't have an iDisk or way of hosting it, just drop me a line and I'll throw it on my iDisk for you. And if you're an AppleScript guru and decide to robust-ify the script (without changing the core methodology), send it my way and I'll host and link back so everyone can get the update. It'll be interesting to see what kinds of creative things everyone comes up with.

Matthew Russell is a computer scientist from middle Tennessee; and serves Digital Reasoning Systems as the Director of Advanced Technology. Hacking and writing are two activities essential to his renaissance man regimen.


Return to the Mac DevCenter

Copyright © 2009 O'Reilly Media, Inc.