Saturday, December 27, 2008

vorbissort: Reorganizing Vorbis comments for the Sansa Fuze

Part of my holiday haul included a 8 GB Sansa Fuze, something I didn't even really know I wanted till I saw it in the Costco Black Friday flyer for $50. My beloved in-laws honored me with this particular gift, which I've been really enjoying over my trusty but aging LifeDrive with TCPMP.

One of the key features I demand from a portable music player is, of course, that it play Ogg Vorbis files. The Fuze recently gained this capability via a firmware update, but it is just a teensy bit rough around the edges yet. Notably, album art, which MusicBrainz Picard will put into the Vorbis comments (if you add the coverart plugin, at least), causes problems.

It's not just that the Fuze doesn't display the album art (which is forgivable, but I hope that gets fixed in a future update; MP3 album art displays just fine), but I found out that where the album art is located within the Vorbis comment stream may break tag parsing—and as the Fuze's library is navigated entirely based on tags, this meant that some music was coming across with unknown artists or missing track numbers... making navigating said music a chore.

Thankfully, it's easy to fix. I found that if I move the album art to the end of the Vorbis comment stream, the Fuze seems to be able to handle everything else. The vorbiscomment utility (part of vorbis-tools, for you Ubuntu/Debianites) can be used to edit the Vorbis comments on your typical Ogg Vorbis file. I automate this process with the following script, vorbissort:
# Reorganize Vorbis comments for the Sansa Fuze, putting album art last in
# the stream, so that other comments don't get ignored.
# Public domain by Matt Behrens <matt@zigg.com> with NO WARRANTY. Back up
# your music first.
# Usage: vorbissort <filename> [<filename>...]

while [ "x$1" != "x" ]
echo $1
vorbiscomment "$1" | grep -v ^coverart >> $tempfile
vorbiscomment "$1" | grep ^coverart >> $tempfile
vorbiscomment -w "$1" < $tempfile
rm -f $tempfile
Typically, you'd cd to the directory containing the Ogg Vorbis files you want to re-sort and type vorbissort *.ogg. (If you're feeling particularly brave, find . -name \*.ogg -print0 | xargs -0 vorbissort can do all your Oggs in one go—but don't you dare try it unless you understand what that entire command line is doing.) I used this on probably a good dozen albums and all came across flawlessly. Once I re-ran my MP3s through Picard, giving them id3v2.3 tags encoded in ISO-8859-1 instead of UTF, the Fuze displayed all my music flawlessly.

Great little player, when it's all said and done. I hope that future firmware versions solve the tag-reading problems.

Labels: , ,

posted by zigg 7:08 PM


Thank you for this utility. I wish I had found it earlier, but I wanted to update you. Sansa's fixed this in its most recent firmware update, *.31. I've got picard writing ID3v2.4 UTF-8, with coverart, and not only will the database refresh, but the cover art will even show.

Anonymous Anonymous February 1, 2010 3:30 PM  

Good to know! I know that even with the last rev, .28 I believe it was (the one that added the slotRadio icon), I still had a few troubles. It was still useful then.

Next time I rip a CD, I'll see how it goes!

Blogger zigg February 1, 2010 10:45 PM  

Further comments are disabled indefinitely. Here's why.