Playing other streams

Discussion about my Wifi Radio project at http://mightyohm.com/wifiradio/ or my WL-520gU talk at NOTACON.
hal
Posts: 10
Joined: Sun Apr 05, 2009 8:29 am
Location: Philadelphia, PA
Contact:

Playing other streams

Post by hal »

So this might be a premature post, since I haven't really spent lots of time playing around with this on my own, but I was wondering how much luck you guys had playing streams other than just streams you find on the internet - for example, have any of you had any luck playing pandora or last.fm streams? I found this discussion on last.fm and mpd:

http://www.last.fm/group/mpd/forum/16122/_/237600

And it seems like everything is broken now, unfortunately.

On a similar, but likely easier note, are there any issues using mpc on the router to connect to a different computer on your home network running mpd and serving up mp3s? I would guess that it's likely the same as just setting up one computer as a music server, and listening on another computer, a topic which I am sure has had much discussion, but i was wondering if anyone had any issues, before I try it myself.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Playing other streams

Post by mightyohm »

I don't know if I've tried using mpc on the router to control my PC, but I have certainly done it the other way around, with my PC (or iphone) controlling the router over the LAN. As long as mpd is running on the PC you want to control, it should work. The default configuration opens a port (I think it's 6600??) to listen for incoming commands.

To tell mpc to connect to another server (not localhost), you need to set the MPD_HOST environmental variable.
There is more info on the mpc man page here: http://linux.die.net/man/1/mpc

I don't have any experience with last.fm or pandora and mpd, but I'm not surprised that they make it hard to do since I think there revenue is based on advertising thru a web client. :roll:
hal
Posts: 10
Joined: Sun Apr 05, 2009 8:29 am
Location: Philadelphia, PA
Contact:

Re: Playing other streams

Post by hal »

I got mpc on the router to talk to mpd on the server (the only hitch is to comment out out the "bind to address" line in mpd.conf on the server). However, to play the music through the router, I think I need to use icecast to send the stream from the server. Which brings up the interesting 'problem' of running 2 copies of mpc - one to control the server's stream, and one to receive the stream.

And as for pandora and last.fm - I totally agree, and it did not make sense to me that they could play music on other clients. But I think there are at least some options. Last.fm used to play in rhythmbox - not sure if it was a hack or an early business model, or what, and if if will be back.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Playing other streams

Post by mightyohm »

Ok, I didn't realize that you wanted to play the music stored on the server via the router. I think you are on the right track:

icecast on the music server PC
mpd on the router, set to play the icecast stream
mpc to control the mpd instance on the router
another client to control icecast on the PC from the router - this is the part I'm not sure about. maybe web interface?
hal
Posts: 10
Joined: Sun Apr 05, 2009 8:29 am
Location: Philadelphia, PA
Contact:

Re: Playing other streams

Post by hal »

I think it's going to be MPC switching back and forth. Seems kinda hacky, but to switch between which mpd the router's mpc is controlling, you can just change the MPD_HOST environment variable. I think that should be the easiest way to do it. I had some problems getting icecast 2 working (mpd would not start playing when the output was set to icecast) in the ~1 hour I spent on it, and I really don't have time to be working on this right now. So I'll let you know how it goes, but who knows. Maybe soon - the less time I have to work on this stuff, the more interested I usually get.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Playing other streams

Post by mightyohm »

Haha, well good luck. :D

I'm still curious why you need mpc to control the remote machine. Doesn't icecast take care of that function for you?
hal
Posts: 10
Joined: Sun Apr 05, 2009 8:29 am
Location: Philadelphia, PA
Contact:

Re: Playing other streams

Post by hal »

Yea, it's mostly working now. I just have a bug where it needs to be told to restart every song, but I have seen other people report that bug, and I have no clue how to fix it. Hopefully I can soon. I was almost there before - there is just another bug in some versions so that you can't be outputting to JUST a shout, you also need to output to an ALSA or OSS device (and only OSS worked for me, for some reason) at the same time.

And I don't think icecast2 does any sort of control...there might be a way to do it, but as it's set up now, it's not too bad. Icecast2 takes my server's mpd output, and streams it to http://192.168.1.123:8000/mpd.ogg My router then connects to this using mpd, and like I said before, I can switch which mpd I am controlling using

export MPD_HOST=192.168.1.123
export MPD_HOST=localhost

That way my router can control the stream - put on some mood music using

mpc search genre soul | mpc add
mpc play

and also control the stream source - my server, or internet radio.

Now if I can just fix that stupid bug so I don't have to keep hitting play constantly....
ciphyre
Posts: 9
Joined: Thu Apr 16, 2009 12:02 pm

Re: Playing other streams

Post by ciphyre »

How did you get mpd to connect to icecast, I can't seem to get it to connect, every time I try it fails and defaults to another playlist.

Also did you ever get the issue fixed with having to hit "play" for every song? I can't seem to get even the native player on the Linux box i am using to host icecast to stay connected to the stream when a song ends.
hal
Posts: 10
Joined: Sun Apr 05, 2009 8:29 am
Location: Philadelphia, PA
Contact:

Re: Playing other streams

Post by hal »

I guess the first key is to make sure that your router can ping your server. If it can, add your server's stream (for me it was http://192.168.1.123:8000/mpd.ogg).


Make sure that mpc is controlling the local mpd, rather than the server's mpd when you do this. If this doesn't work, I have no clue - maybe a firewall issue? I had no real problems with this. My only problem was getting icecast to stream in the first place (as I said, solution was to output sound to icecast and another device at the same time), and the stopping after every song problem which I have yet to look into further/fix.

Good luck!
ciphyre
Posts: 9
Joined: Thu Apr 16, 2009 12:02 pm

Re: Playing other streams

Post by ciphyre »

I discovered the root cause of the issue we are both experiencing where mpd stops playing after each song and has to be restarted in order to play the next song.

The issue is with support of chaining ogg vorbis file headers or the lack there of. While the version we are using, mpd.0.13.2 supports playing ogg vorbis files (the default for ices2) it will not play ogg vorbis files back to back. So to get around this issue I switched to ices0.4 and switched to streaming mp3 files instead. If you are using Linux like I am you need lame to do the mp3 encoding/decoding prior to compiling ices0.4.

I am now streaming mp3 files from icecast to six different rooms using a router in each room, plus a set of PC speakers w/wireless remote. The total cost for a whole home audio system was less then $400.
Post Reply