Streaming MP3s to a Nokia 770

The Nokia 770 has little storage capacity, the largest RS-MMC cards on the market are 1Gb, and it doesn’t support networked file systems, so I cannot access my music via NFS or Samba and I can’t carry much on the system itself.
Streaming was the way to go, it seemed.
It proved at bit harder than expected, though.

mod_musicindex

First I tried with the Musicindex module for Apache2. It worked quite well with other systems, but it insisted on sending the playlists with the mime type audio/mpegurl, which isn’t associated with the Audio Player on the Nokia 770, so I had to download the playlists and open them manually in the Audio Player.
Apparently, Nokia 770 wants playlists with the mimetype audio/x-mpegurl and not audio/mpegurl.
I tried just about everything with AddType, ForceType and rewrite rules, without much success.

GNU MP3 daemon

I them switched to GNUMP3d which is a separate program, that is, not a module for Apache.
That too worked well with most normal music players, but not so with the Nokia 770’s Audio Player.
I kept getting messages about malformed playlists and if the playlist loaded, it would just skip from one song to the next without playing anything.
The two problems are completely independent, it seems.
The Nokia 770 Audio Player wants playlists to be valid and correct UTF-8. Otherwise they are turned down.
I run my systems with a default UTF-8 locale (a mix of English and Danish) so alle my filenames are in UTF-8. The tags in my mp3 files were in ISO-8859-1, however.
GNUMP3d builds a small database with the tags from mp3 files which also contains the filenames, so that file becomes mixed UTF-8 and ISO-8859-1. The playlists generated by GNUMP3d then also becomes mixed, and the Nokia 770 player refuses to use the playlist.
Consequently, I had to redo all the tags in my mp3 collection. I tried to convince gnump3d-index to convert the data, but never got it to work. Redoing the tags was easier after all 🙁
Some songs kept causing errors, almost no matter what I did. Apparently GNUMP3d doesn’t handle songs whose title or filename ends with a �. This is one of the weirder bugs I have encountered (reported to Debian as bug 340989). The accented letter � is encoded in UTF-8 as � followed by the byte �240 which is a non-breaking space in ISO-8859-1. When writing the metadata database, GNUMP3d trims the fields for leading and trailing whitespace, and this causes the � the remain alone which is not valid UTF-8.
I didn’t feel like rewriting the entire metadata database for the program, so I just changed the titles and tags to include a final period. That solved the problem for now.
After some time I got the gnump3d database to validate as UTF-8 by trying to convert it to ISO-8859-1 with iconv(1).
GNUMP3d still told the browser the pages were in the default charset of ISO-8859-1, and it took me quite a while to find the correct way to fix it. Simply add the line

add_meta_tag = <meta http-equiv="Content-Type" content="text/html;charset=utf8">

to the file /etc/gnump3d/gnump3d.conf.

Nokia 770 Audio Player

So far, so good. I now had playlists that the Audio Player accepted. Too bad it didn’t play anything, because it skipped silently from one file to the next, until it hit the end of the playlist.
Researching the problem a bit and studying the access and error logs of GNUMP3d (which has its own little web-server build in) revealed a bug in the Audio Player (reported as bug 296). It seems it encodes the urls in the playlist even though they are already encoded, so a space in an url, written in the playlist as %20, becomes %2520 when it is returned to the webserver (which in this case is GNUMP3d).
Since I cannot fix the bug in the Audio Player, I made a workaround in GNUMP3d, with this little patch:

--- /usr/share/perl5/gnump3d/url.pm~    2005-11-19 18:28:41.000000000 +0100
+++ /usr/share/perl5/gnump3d/url.pm     2005-11-27 14:49:07.000000000 +0100
@@ -74,6 +74,9 @@
     # This '+' -> ' ' conversion shouldn't be necessary ..
     # It's here to correct possibly buggy calls.
     $text =~ s/+/ /g;
+
+    # Nokia 770 audio player workaround
+    $text =~ s/%25([0-9A-H]{2})/%$1/g;
     #
     #  Unpack %XX characters into their intended character.

Its not a beauty, but it does the trick, and the 770 Audio Player can get the files and play the music.


Comments

4 responses to “Streaming MP3s to a Nokia 770”

  1. Reinhard Enders avatar
    Reinhard Enders

    I’m still waiting for my 770, so I wasn’t able to try out http://vidar.gimp.org/n770/… by myself.

  2. Cayle Graumann avatar
    Cayle Graumann

    The 770 supports NFS, although you have to gain root access and use xterm to mount the exported file system. the trick is that the file manager does not show anything unless it appears under the MyDocs directory in the user home directory. You will need to create a link to the mount location under this folder. I have ha good luck with playing video from the nfs mount.

  3. Regis Boudin avatar
    Regis Boudin

    Just saw this entry, and as an upstream author of mod_musicindex, I just wanted to let you know that de “audio/mpegurl” VS “audio/x-mpegurl” problem has been fixed some time ago. So if you grab a more recent version, it should work better.

    In any case, when you have a problem like this, don’t hesitate to contact the upstream author ;).

  4. I just picked up a 770 (Sept 2007) and a Kingston 2 GB RS-MMC card. It’s very slow. When you hook the 770 up to a computer via USB, both Linux and Winders XP often fail to write files, perhaps due to timeouts. Full read after full write verify is recommended. The 770 itself is pretty reliable, but can do little else while it writes to the card. At least reads are fast. So, while 2 GB works, i recommend the 1 GB Sandisk.
    I have a wireless router. If the 770 could stream audio from my main machine’s, then i could hook it up to my larger house stereo. I mostly use an iPod for this, though not streaming. I’d dedicate a computer to it, but don’t want fan noise in the listening area. The 770 has no moving parts, so should work well. It does work well for audio local to the 770.
    My repositories file is currently hosed, so i’ll need to reflash (again). This time around, gainroot is a priority, as i can’t install anything, so can’t break root. Feh. How did the repositories file get corrupted? I believe I added a bad repository. There’s no way to fix it from the interface, and the actual file can only be edited by root.

Leave a Reply

Your email address will not be published. Required fields are marked *