Thursday, March 24, 2005

Why iTunes rocks

I claimed a while ago that iTunes rocks. Here's why: having all your music at your fingertips at all times completely changes the way you experience music.

We went digital by necessity: a dead hifi left the PC's CD-ROM drive as the only device we owned capable of playing music. But we stayed there by choice.

The biggest, most fundamental difference: every piece of music you own is a few clicks away. When you play CDs, there's a cost to changing albums: eject, swap, load. And that's if you can find the CD you want to listen to. Often you can't be bothered; easier to simply play the CD again, or rotate through the stack of CDs close to hand. When you're playing digital, changing albums is as cheap as changing tracks. You can be much more of a magpie; roaming across the library, picking artists, albums, tracks at a whim. Everything's to hand. It lures you into becoming your own DJ.

iTunes isn't unique in this, of course; before Windows iTunes appeared, we used RealJukebox (now RealOne or Real Player 10 or whatever it is Real call it this month). But iTunes does it very well: it's slick, quick, and intuitive.

iTunes search is great for roaming the library. It searches for full or partial words across all the track metadata (artist, album, track name etc). And it does it live and on-the-fly; you can see the search narrowing as you type more characters. It feels enormously natural: you remember an artist and maybe one word of the title, type 'em in, and up comes the track.

Oddly, though, I didn't twig this to begin with. Maybe it's the engineer's viewpoint, but my first impulse, faced with tracks organised by artist and album, was to find tracks by first finding and selecting the artist, then finding and selecting the album, and then finding and selecting the track. "Why would you want to search?" I thought, "it's all organised logically for you." Melinda's first impulse, faced with a huge library of tracks, was to go for the search box. And boy, was she right: it's quicker, easier, and more flexible to search than to select.

Recent iTunes versions add Party Shuffle, which essentially allows you to have iTunes play DJ for you, picking tracks at random from the library. At first glance this seems underwhelming; I can do a better job than that! But using Party Shuffle tends to break you out of your recent favourites, pulling up tracks from albums you might not have heard for a long time.

But best of all, you can co-operate with Party Shuffle: you can override it's choices of upcoming tracks. Reorder them. Delete them, forcing it to choose again. Add your own choices. You get to cooperate with iTunes, deciding how much freedom to give it. I love this: Party Shuffle pulls up a mixture of the familiar and the esoteric, leading me into albums and tracks which I don't necessarily remember well, and if I like what I hear I can take over and cue up more of the same.

It's not clear what algorithm Party Shuffle uses to choose tracks. You can tell it whether or not to favour highly-rated songs, but it often feels like there's more than pure randomness at work. It'll often pick songs by the same, or related, artists close together. Conspiracy theories abound. My suspicion is that it's pattern-matching and selective memory at work: it probably is truly random, but us humans are very good at spotting islands of order amid chaos, and we're better at remembering the pleasingly-ordered selections than the less-interesting stretches of randomness.

As the library gets bigger, maintaining it becomes more of a task. Metadata becomes more and more important the more tracks you have. Accurate titles, years, and genres make searching and playlisting easier and more flexible. But at a more basic level, there's something enormously satisfying about a well-organised properly-labelled iTunes library. And there's a payoff for having decent track metadata: it's food for Smart Playlists.

Smart Playlists choose songs from the library by matching against the metadata, so you can build playlists of (for example) "20 random 70's songs", or "all country songs". And iTunes generates extra metadata for you: it keeps track of how often each track is played and when it was last played, so you can build playlists like "most recently played songs" or "all songs never played". Smart Playlists are live, so when you change the metadata (by editing the track's info, or simply by playing the track) the playlists are automatically updated.

It goes deeper and deeper; you can build playlists with multiple conditions ("all songs rated 4 stars or higher that were not played in the last month") and you can build playlists which theselves refer to other playlists ("all songs which appear in either/all of these playlists"). More and more ways of exploring the library, more and more ways of tuning iTunes to approach your ideal personal radio station; more and more things to play with. It's so much fun that there's a blog dedicated solely to collecting Smart Playlist settings:

And Smart Playlists themselves play well with Party Shuffle: you can set Party Shuffle to choose songs from either the whole library or from a playlist. Bingo! Create a Smart Playlist of "all songs never played or not rated", Party Shuffle on it, and you get iTunes playing DJ over all the stuff that you either haven't listened to yet or that you haven't rated yet.

Finally — and this appeals to me enormously as a software engineer — iTunes is extendable and scriptable. Extendable with a plugin architecture, which is how visualisers like the excellent G-Force hook into iTunes. Mac iTunes was AppleScript-able from very early on; us Windows users had to wait until release 4.5, which is scriptable from VBScript, Perl, Python etc via a rather nice set of COM interfaces.

I'm not sure anyone's done anything major with the COM interfaces: they're still relatively new. But they're ideal for knocking up quickie utility scripts. Simon Brunning's had some fun with them using Python (fixups, batch conversion), which works very well once you've gotten to grips with the (rather sparsely documented) pythonwin extensions. Hopefully the large number of iTunes AppleScripts available on the web (many collected at Doug's AppleScripts for iTunes) will inspire Windows scripters.