Skip to content

Ampache (+Mobile) Rocks!

For a while, I’ve been wondering when Apple will finally ditch the put-storage-in-the-iPod-and-sync-to-your-computer model and just let you keep a library of music in the cloud and stream it. I thought that day was here when Apple bought Lala. It hasn’t come. (Yet.)

For a long time, I’ve been using my 8GB nano and using smart playlists to let the computer figure out which songs should be on there. It worked fine. Now, I have an embarrassment of riches with a 16GB Palm Pre Plus.

Except, due to a few years of eMusic and an addiction to AmieStreet, I still have way more music than I can fit on it. Remember: the smart playlist thing only works if you can rate songs. I tried out MediaMonkey and DoubleTwist. They worked okay, except neither one seemed to have smart playlists. Even if they did, there really wasn’t a way to rate songs on the Pre and have it notify MediaMonkey/DoubleTwist of the new ratings, so that I could create a smart playlist that would favor me (i.e. favor songs that I like).

For a while, I’ve noticed a Palm Pre app called Ampache Mobile. I shrugged it off as the usual tech rabbit-hole that I go down, where I spend months trying to figure something out and it never works.

Except, this time it worked, and very well, I might add.

The way it works is you set up a web server running apache with a PHP-based application called Ampache. You then install the Ampache Mobile app on your Pre. Once you’ve set them both up, you can stream your music catalog from your web server (for example at your home) to your Palm Pre. This actually doesn’t take up a lot of bandwidth; for me, 32 kbps sounds bad, but 64kbps sounds fine enough where I don’t notice, and my home ISP can sustain 128 kbps (probably 192 kbps, too, but I haven’t tried it).

I took that Atom FreeBSD machine that I always harp about and installed apache, mysql, and php (which power ampache). There’s even an up-to-date port of ampache in the ports catalog. (Note: install this after you install the pre-requisites listed here.)

As it turns out, it took a while to figure out. But, it wasn’t nearly as bad as I thought. In fact, the configuration involved in getting it running was pretty quick. I spent a little time figuring out how to transcode so that I wasn’t saturating the upstream bandwidth from my house.

First, I had to enable this. For some reason, mp3splt didn’t work well on FreeBSD. So, I used the “alternative” transcode command, which only uses lame. I then had to figure out how to change it from the default 32 kbps to something more pleasing to the ears (I’ve found 64 kbps is pretty good, but I’m putting it at 128 kbps). As it turns out, there are two places to put settings: (as an administrator) system-wide, and (as a user, including the administrator) per-user. I had been changing the system-wide settings, but didn’t realize my per-user settings over-rode them.

After I got that figured out, things were pretty good (except this morning, when CrashPlan was backing up some new data and contending for upstream bandwidth). One might expect that using a mobile phone wouldn’t be terribly reliable for streaming music. However, with Ampache Mobile’s generous buffering, I’ve had more trouble with my home ISP’s uplink bandwidth than with variation in cellular bandwidth.

For a while, I didn’t realize I was still listening to 32 kbps MP3. I thought the lower fidelity was because I was taking MP3 files and re-transcoding them down (allegedly to 128 kbps, but that was wrong). In addition, all my CD’s were ripped to AAC (MP4) using iTunes. I am now re-ripping them using FLAC (using dMC which I bought a long time ago); Ampache will transcode them to MP3 on the fly. (I had to install the flac and lame ports on FreeBSD; while I was at it, I installed faad, just in case.) These new FLAC files are exactly what CrashPlan is backing up off-site right now, which is why I had bandwidth troubles this morning.

Finally, I also run this blog on WebFaction. Since I have a bit of disk space, I figure I might as well run a personal Ampache server there, too, for when my home bandwidth isn’t available. Due to the limited disk space, I do have to chose which files get uploaded to the server. I decided it should be my new purchases. So, I wrote the following script to scour a specified directory, look for files that are newer than 1 week old (7 days), and send them to the server (had to install rsync port):

#!/bin/sh

dirname=”$1″

find “$dirname” -type ‘f’ -mtime -7 > files.lst
rsync -av –files-from=files.lst “.” “webfaction:/home/xxxx/webapps/ampache/catalogs”

I’ll add the —delete-exclude option to rsync when I’m a bit more certain things are working as planned. Now, I have my week’s latest music (which I’ll probably bump up to 1 month’s latest once I verify the disk space requirements) in full-bandwidth, no-transcode regalia. However, I can always listen to my entire collection from my home server at will.

I also figured out my problem with the default mp3 transcode command. The default mp3 transcode command is [ccie_winbatch]mp3splt -qnf %FILE% %OFFSET% %EOF% -o – | lame –mp3input -q 3 -b %SAMPLE% -S – -[/ccie_winbatch]. The problem is the [ccie_winbatch]mp3splt -qnf %FILE% %OFFSET% %EOF% -o –[/ccie_winbatch], where the –o proceeds the filename. Instead, it should be [ccie_winbatch]mp3splt –qnf –o – %FILE% %OFFSET% %EOF%[/ccie_winbatch].

This rocks!

P.S. I’m using drPodder to listen to podcasts directly on the Pre, and that pretty much takes care of all the functionality of my iPod.

Be the first to like.

2 Comments


  1. Fatal error: Uncaught Error: Call to undefined function ereg() in /home/wagh/webapps/techblog/wp-content/themes/plaintxtblog/functions.php:183 Stack trace: #0 /home/wagh/webapps/techblog/wp-content/themes/plaintxtblog/comments.php(33): plaintxtblog_commenter_link() #1 /home/wagh/webapps/techblog/wp-includes/comment-template.php(1508): require('/home/wagh/weba...') #2 /home/wagh/webapps/techblog/wp-content/themes/plaintxtblog/single.php(43): comments_template() #3 /home/wagh/webapps/techblog/wp-includes/template-loader.php(98): include('/home/wagh/weba...') #4 /home/wagh/webapps/techblog/wp-blog-header.php(19): require_once('/home/wagh/weba...') #5 /home/wagh/webapps/techblog/index.php(17): require('/home/wagh/weba...') #6 {main} thrown in /home/wagh/webapps/techblog/wp-content/themes/plaintxtblog/functions.php on line 183