Internet Radio


39 posts   Page 1 of 2   1, 2
by kghunt » Tue Mar 13, 2012 10:21 am
I would love to make an internet radio. So I would need to make a case to house the pi a battery and a speaker.

I would set a virtual interface on the pi that is always there to a 169.254 address so I can configure the main IP of the device. Probably use webmin for the config (don't reinvent the wheel).

Buy a cheap lcd for the display that works with lcdproc or similar project.

Then all I need is a command line internet radio streaming service. Maybe even spotify (if it will work on arm and command line).

It would also be cool if I could make it support airplay plus any other cool features like that.
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by gjs » Tue Mar 13, 2012 1:47 pm
You may find this, similar, project interesting:

http://www.engadget.com/2009/0.....and-tears/
Posts: 148
Joined: Fri Dec 02, 2011 8:04 pm
by kghunt » Tue Mar 13, 2012 4:14 pm
That is amazing. I am going to be doing this definitely. This is what the pi is made for!! I don't think my case will be as elaborate and I will probably use usb lcd that is already built.
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by error404 » Tue Mar 13, 2012 6:12 pm
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm
by kghunt » Wed Mar 14, 2012 5:35 pm
I have made some progress.

I read through the entire article posted above and it is great although I played around with mpd I struggled to get it to play wma streams (all bbc streams are wma). So I went with xmms2 instead. This was a doddle to set up. got it working a treat skipping around playlist starting stopping etc.

I have ordered a usb sound card

http://www.ebay.co.uk/itm/2006.....047wt_1041

it was £2 and supports linux. The volume buttons etc can be remapped using lirc too so I will wire these up to buttons for play/stop prev/next which should be pretty easy (done all this before on media centre projects)

I have also ordered one these lcd's

http://www.ebay.co.uk/itm/2209.....414wt_1013

£12

My plan is to get this working with LCDproc or similar project and get it to display the current playing stream. If I can get it working I have uses for it in other projects too like displaying current IP for ssh. It Would be cool if I had a 5th button that when pressed displays the current IP or when two of the current buttons are pressed together.

All I need now is a cheap pair of speakers. Eventually when I get a model A I will probably substitute it in.

I also need a real cut down distro maybe DSL or something. No sense in having loads of bloat for a headless internet radio.

I will probably put a web front end on xmms2 too to edit playlists etc. But there are also mobile apps for this.
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by naicheben » Wed Mar 14, 2012 8:09 pm
Posts: 344
Joined: Sat Jan 28, 2012 12:28 pm
by kghunt » Wed Mar 14, 2012 9:58 pm
I don"t really fancy the world service though. I was thinking more along the lines of radio 1.

Because I may be using the USB sound card on a router for the office Internet radio, I may need some controls for my pi version. I was thinking I could just get another USB sound card for the price even though the pi has sound I could use it for the controls. Or I could take the opportunity to use something else either using gpio or hack a cheap Chinese game controller.
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by error404 » Wed Mar 14, 2012 11:48 pm
Ick. WMA. I think mpd can decode these streams, but you might need to do some poking around with a text editor to find out the stream URL, since it probably doesn't support the .asx playlist. Try searching around the MPD forums if you can't figure it out, but I think it should work.

BBC also appear to have their streams as MP3 (likely for their Flash player), but doesn't seem to publish the URLs. However these seem to work: http://www.listenlive.eu/uk.html
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm
by naicheben » Thu Mar 15, 2012 9:42 am
Yes that seems to work.

Download the pls with wget, add the url to the playlist (but beware of "&" you must escape it with a backslash) This is how it works here:


wget http://www.bbc.co.uk/radio/lis.....aaclca.pls

cat r1_aaclca.pls

(choose a stream)

mps clear

mpc add http://bbcmedia.ic.llnwd.net/s.....1331796933\&e=1331811333\&h=c10664b1bb659ffb39b2e7e16eebe022

mpc play

Posts: 344
Joined: Sat Jan 28, 2012 12:28 pm
by kghunt » Thu Mar 15, 2012 9:55 am
That is still not working for me. Its alot of faffing when xmms2 just plays them?
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by error404 » Thu Mar 15, 2012 11:18 am
Maybe, but MPD actually has good apps that already exist for pretty much every platform to control it over the network. Which seems to be your end goal.
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm
by naicheben » Thu Mar 15, 2012 11:41 am
It does not work for you with the link I posted because these are session dependent. If you do not like to programm a batch script your self, then you are better of with xmms2 ….

EDIT:

this script works for me (well not realy beautifull, but it works)


#!/bin/bash
rm r1_aaclca*
wget http://www.bbc.co.uk/radio/lis.....aaclca.pls
grep "File1=" r1_aaclca.pls > streamaddr
mpc clear
mpc add $(sed 's/File1=//g' streamaddr)
mpc play

Posts: 344
Joined: Sat Jan 28, 2012 12:28 pm
by Jim Manley » Thu Mar 15, 2012 4:40 pm
Are you running these under the Debian emulated on the R-Pi to make sure that everything works on ARM?
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
User avatar
Posts: 1358
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, USA
by SN » Thu Mar 15, 2012 4:58 pm
kghunt said:


I have made some progress.

I read through the entire article posted above and it is great although I played around with mpd I struggled to get it to play wma streams (all bbc streams are wma). So I went with xmms2 instead. This was a doddle to set up. got it working a treat skipping around playlist starting stopping etc.

I have ordered a usb sound card

http://www.ebay.co.uk/itm/2006.....047wt_1041

it was £2 and supports linux. The volume buttons etc can be remapped using lirc too so I will wire these up to buttons for play/stop prev/next which should be pretty easy (done all this before on media centre projects)

I have also ordered one these lcd's

http://www.ebay.co.uk/itm/2209.....414wt_1013

£12

My plan is to get this working with LCDproc or similar project and get it to display the current playing stream. If I can get it working I have uses for it in other projects too like displaying current IP for ssh. It Would be cool if I had a 5th button that when pressed displays the current IP or when two of the current buttons are pressed together.


B*ll*cks - paypal/creditcard is quivering on those ebay links - SWMBO will kill me when she sees the current credit card bill for 'toys' bought on a whim on the pack of this b*ggering little Linux device ;-)
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?
User avatar
Posts: 1008
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
by naicheben » Thu Mar 15, 2012 5:58 pm
Jim Manley said:


Are you running these under the Debian emulated on the R-Pi to make sure that everything works on ARM?



Me? No. I don't know if it makes sense to test it in an emulated Debian. I wrote the script on my laptopwith Ubuntu. I know the R-Pi doesn't have windows32-codec-Pakage, but I'm not sure if it's realy needed, because error404said it's MP3.
Posts: 344
Joined: Sat Jan 28, 2012 12:28 pm
by kayaker » Thu Mar 15, 2012 6:09 pm
I really like this project idea!  I'll certainly follow along in the the hopes of doing something similar.   But, MOSTLY I just wanted to say...  I had to look up "SWMBO"... and now I'm cracking up!   I'll definitely be using that in some of my posts!   ;-)

I do hope you start a blog or a project page on this one.  Sounds like fun (even if a bit above my linux-noob head).  Good luck!
Posts: 28
Joined: Sat Mar 10, 2012 1:41 pm
by kghunt » Thu Mar 15, 2012 7:58 pm
It does not work for you with the link I posted because these are session dependent. If you do not like to programm a batch script your self, then you are better of with xmms2 ….

EDIT:

this script works for me (well not realy beautifull, but it works)


#!/bin/bash
rm r1_aaclca*
wget http://www.bbc.co.uk/radio/lis.....aaclca.pls
grep "File1=" r1_aaclca.pls > streamaddr
mpc clear
mpc add $(sed "s/File1=//g" streamaddr)
mpc play


I didn"t realise they were session dependant. I don"t mind writing bash I have done some fairly complicated interactive scripts for installing and setting up 3G dialling on the command line. I"m lpic1 don"t ya know :-p.

If they are session dependant then I will have to script it to update the playlist every time I want to listen to BBC. Why do the beeb have to make everything so complex every other radio station just has a static mp3 stream.

Anyone got any ideas for an easy chassis? I"m thinking old tape deck jobby with the LCD in the plastic window and the big chunky buttons on micro switches.

12 + 6 these a getting harder! :-p
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by kghunt » Thu Mar 15, 2012 8:05 pm
kghunt said:


I have made some progress.

I read through the entire article posted above and it is great although I played around with mpd I struggled to get it to play wma streams (all bbc streams are wma). So I went with xmms2 instead. This was a doddle to set up. got it working a treat skipping around playlist starting stopping etc.

I have ordered a usb sound card

http://www.ebay.co.uk/itm/2006.....047wt_1041

it was £2 and supports linux. The volume buttons etc can be remapped using lirc too so I will wire these up to buttons for play/stop prev/next which should be pretty easy (done all this before on media centre projects)

I have also ordered one these lcd"s

http://www.ebay.co.uk/itm/2209.....414wt_1013

£12

My plan is to get this working with LCDproc or similar project and get it to display the current playing stream. If I can get it working I have uses for it in other projects too like displaying current IP for ssh. It Would be cool if I had a 5th button that when pressed displays the current IP or when two of the current buttons are pressed together.


B*ll*cks - paypal/creditcard is quivering on those ebay links - SWMBO will kill me when she sees the current credit card bill for "toys" bought on a whim on the pack of this b*ggering little Linux device ;-)

Ha ha. I won"t tell you about the 14 quid USB 4 output relay board I saw then...
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by kghunt » Wed Mar 21, 2012 12:03 pm
The USB sound card arrived. I plugged it into my laptop (ubuntu) it was recognised instantly and worked perfectly good sound quality too. All the buttons worked too changing the volume etc, just need to figure out how to remap them. I am well impressed I may be ordering another one if I integrated this one into an internet radio.

The only problem I can forsee is the connections to the buttons on the pcb are small so my be hard to solder to.
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by kghunt » Wed Mar 21, 2012 1:18 pm




Here is the usb audio device. In the picture above if I bridge the top right and bottom left connections of any of the buttons it simulates a button press so it should be fairly easy to solder on some new buttons. I have not tested the line in yet but I see no reason why that would not work either.
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by dom » Wed Mar 21, 2012 9:16 pm
naicheben said:

this script works for me (well not realy beautifull, but it works)


Sure does - listening to radio 1 (I think) on the Pi right now...
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4058
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by naicheben » Wed Mar 21, 2012 9:59 pm
dom said:


naicheben said:


this script works for me (well not realy beautifull, but it works)



Sure does - listening to radio 1 (I think) on the Pi right now...



Wow! Thanks for testing. MY FIRST SCRIPT FOR RPi!!!  :) )))
Posts: 344
Joined: Sat Jan 28, 2012 12:28 pm
by kghunt » Thu Mar 22, 2012 8:38 pm
How would one implement the script? I mean the rest of the mp3 stations will be in a playlist. Cron the script to run at certain intervals or is there a way to get mpc to invoke the script when you reach a certain place in the playlist?

Does anyone know how long a session lasts?
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by kghunt » Wed Mar 28, 2012 1:08 pm
My £12 LCD arrived today from sure electronics. Plugged it in and within 15 mins had it up and running with lcdproc.

All I had to do was set the driver as SureElec and define the display size and voila.

I think Im going to get a bigger one 20x4 as there is another app call lcd stuff that is menu driven that would be cool for changing tracks etc. Or maybe that could be my first programming project.

Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by walney » Wed Mar 28, 2012 1:32 pm
Nice toys!

I would be interested in the display for another project. Would you happen to have dimensions to hand (I need to try and fit it in a 1U server)?

[Edit: meant to ask - how long did it take to ship?]
User avatar
Posts: 233
Joined: Wed Nov 30, 2011 6:57 pm