I’ve just moved to OS X for all of my development. Gotta have music while programming, but a large part of my music library is in Ogg Vorbis. Mac doesn’t support Ogg out of the box, so here’s how to get it going. It took me awhile to figure it out, so I’ll summarize to save others time. I’m going to cover using Ogg in iTunes from both a local iTunes library and for music stored across the network on another machine (in my case, a Ubuntu Linux server).
If you want to skip all this crap and just convert the things to mp3 so you can stick them on your ipod and every other player, take a look at this ogg2mp3 perl script.
iTunes, and I think Mac apps in general, use the QuickTime engine for media playback. So if you want to play something in iTunes, QuickTime needs to know what the heck it is.
Fortunately, the folks behind Ogg have recently developed a free, open source Ogg QuickTime component. When you download and install that, QuickTime can play your ogg files.
What about iTunes
iTunes can play them too; try it. However, there are some severe limitations, but I’ll describe what I did in my setup as workarounds.
iTunes can only play Ogg files on your local file system
It cannot play them over streaming daap shares. This is because iTunes assumes all daap streams to be of type mpeg. Fix your bugs Apple!
While this isn’t a direct remedy, you can still play Ogg music in iTunes even if it’s stored on another computer. You can just mount the files from another computer onto your OS X file system, and they appear to iTunes as if they’re local.
This would usually be a kludge, but it’s not, because OS X’s automounting code is brilliant. In the finder, select Go -> Connect to server. Find the server that has your music files (whether it be Windows or another Mac) and a link will be made on your desktop. Right click on the link and say “make alias.” Now a permanent shortcut resides on your desktop to the remote server. Even if you reboot and then double click that alias, the remote files will get automounted. Awesome.
In iTunes, go to preferences and uncheck “Copy files to iTunes music folder when adding to library.” Now, you can drag and drop ogg files from your remote computer into your iTunes library, and they’ll play as if they resided on your own hard disk.
If you happen to have your music on a Linux server instead of another Mac or Windows box, you can share the folder containing your music very easily over the afp protocol. It’s really simple on Ubuntu:
apt-get install netatalk
apt-get install zeroconf
nano /etc/netatalk/AppleVolumes.default
The syntax of the AppleVolumes file is this:
<local path> <volume name> allow:<user1>[,<user2>,...]
Just make an entry for your music folder and you’re done. Macs can now connect and mount the folder with an entry like “afp://myserver/musicFolder” in the “connect to sever” dialog of the Finder. Easy.
Track names in Ogg files aren’t picked up by iTunes
If you like to listen to an album’s tracks in order, this can be really freaking annoying. iTunes doesn’t read the track number from the Ogg file’s header! That means iTunes will play your tracks in alphabetical order.
This is what you can do: after you’ve imported all of your oggs, run an Apple Script over them. It will manually look at the file’s header information, parse the track number out, and update the iTunes database so that it has the track numbers.
It’s pretty simple, although tedious. Put all the tracks you want “scanned” in a big playlist in iTunes. Have that playlist open in your iTunes window.
Download the script here, unzip it, and double click the script file. Click run, and it will process the files you have in your playlist. It takes a long time to run, “40 minutes to process 1858 songs” according to the author. Here’s more info about the script from the author, Tim Allen.
Caveats
It’s a bit of hack already, but there are a few more things to be aware of.
If you edit a file’s metadata in iTunes, it isn’t written back to the Ogg file. I don’t know if that’s the case for all media files, but don’t go doing massive changes on your music collection and expect them to be in effect outside of iTunes.
That’s it. If anyone knows how to get iTunes to scan my locally-mounted music folder every once in awhile to pick up any new stuff, let me know.