I listen to music pretty much constantly so I'm willing to expend significant time and effort optimizing my listening situation. That's why…this. Specifically, setting up a UPnP media server for streaming music from foobar2000 to a wi-fi enabled Creative Zen X-Fi, or to 2Player on Android, or presumably to any half-decent UPnP media client (iPhone, Xbox, PS3, another computer, etc.)
I have my music collection on my laptop, but I want to listen through my amplifier and speakers way over there—well, too far to reasonably connect physically via cable. I also have an mp3 player that contains the pretty much all of my music collection that I can hook up through my stereo. But I don't want to have to walk all the way over there every time I want to play something different. That's suboptimal. There Has To Be A Better Way!!
Incidentally, my mp3 player is a Creative Zen X-Fi 32GB, which is capable of wi-fi networking type business. This functionality had nothing to do with why I bought this specific device. In fact I thought its wi-fi capability was some combination of unnecessary and ridiculous and I set it to airplane mode and disabled the wi-fi. But now, it's interesting…
"So it looks like the mp3 player is capable of streaming across my wi-fi network as long as there's some type of streaming server to feed it, but what type? What protocol? Well, there's the bundled Creative Centrale software, but that stuff is basically pure garbage…"
After some digging online I discovered that the Zen X-Fi is a UPnP client, so I needed a UPnP media server. Well, there are a number of UPnP servers out there, but I went with the foo_upnp component for foobar2000 since, you know, it exists and foobar2000 is what I use to play music anyway. Convenient.
Install foo_upnp
Download the foo_upnp component, unzip, and install. You'll have to restart foobar2000 before continuing.
Start the UPnP Media Server
Name and start your foobar2000 UPnP media server. As you can see, mine is called 'muzak' and it plays Kenny G (aka "The 'G'") 24/7.
Enable Playback Stream Capture
In the UPnP → Server → Content settings section, make sure that
Show Playback Stream Capture
is checked. This allows you to stream
whatever is being played in foobar2000 on your computer with your mp3
player, phone, or whatever.
Create a Streaming Profile for your Device(s)
It will likely be necessary to setup a streaming profile for whatever
device you're using as your streaming client; it is for the Zen X-Fi.
The key sections are Use profile when
and Playback Stream Capture
.
The Creative Zen doesn't really identify itself very uniquely; its
user-agent string is something like UPnP/1.whatever
, which basically
just declares that it's a UPnP capable device… so the best we can do
is to set User-Agent
→ UPnP
in the Use profile when
section. In
the Playback Stream Capture
section, the codec needs to be set to
mp3
and not wav
or lpcm
, because they don't work with the Zen
X-Fi.
I'm not 100% positive about this, but my guess is that the
Transcode to MP3...
section comes into play when you stream physical
files from the server. In other words, if you're trying to stream an
ogg-vorbis file from your server but your device can't play ogg-vorbis
files then this section should be configured such that ogg and other
incompatible types are on-the-fly transcoded to mp3.
If you have an Android phone, there's a pretty slick UPnP client
available called 2Player. This is basically the same deal as with
the Zen X-Fi, except 2Player actually identifies itself quite thoroughly
(its User-Agent
string tells you it's Android, UPnP, & twoPlayer) so
it's possible to setup a streaming profile that you can be almost
certain will match only this particular device (this is a good thing.)
Streaming in Action
Here's a little video demo of playback streaming on my Zen X-Fi and HTC Hero Android phone using 2Player. You might notice that the Zen hiccups and stops playing a couple of times, which I think is probably related to its relatively low processing power. I mean, it's just a tiny pocket-sized mp3 player so it's kind of impressive that it can pull this trick off at all. And mostly it works without hiccups after it gets going.
Final Thoughts
I'm hoping to figure out is how to reduce the lag between what's playing in foobar2000 and what's playing on the client, which seems to be around 10-15 seconds generally. Maybe there's a buffer value that can be adjusted somewhere…