IMPORTANT UPDATE – July 2015: BBC Radio addresses have changed – see here for more info. And Fip has moved to http://audio.scdn.arkena.com/11016/fip-midfi128.mp3
Continuing the theme of making something useful out of unloved gadgets lying round the house, today I started to build some sort of audio device from another unused Raspberry Pi and an ancient Griffin iMic – this was a silver hockey-puck shaped USB audio IO device that I bought donkeys years ago for my Bondi Blue iMac. I also found some old powered PC speakers that had been in the loft, and a random old power supply.
I’m not sure if I’m eventually going to make an internet radio or something to stream audio from some networked storage yet – the first step was to get some sound out.
It’s a good idea to use a USB audio device for music on the Pi, as the onboard audio jack is not good quality.
I started by following the advice here: http://computers.tutsplus.com/articles/using-a-usb-audio-device-with-a-raspberry-pi–mac-55876
In short, I copied a WAV file onto my Pi’s desktop, and rebooted the Pi up with the Griffin iMic plugged into the top USB socket (I tried it in a powered USB hub and it didn’t work). I then edited an audio config file by typing
sudo nano /etc/modprobe.d/alsa-base.conf
at the command line, and commenting out the line
options snd-usb-audio index=-2
by putting a hash sign at the front:
# options snd-usb-audio index=-2
and saving it by pressing ctrl-x and y to over-write the file.
I plugged my PC speakers into the mains, plugged the jack into the iMic’s audio out socket, then rebooted the Pi, navigated to the desktop at the command line and typed
and sweet music came forth! Didn’t even need to hunt for any drivers. (I do love the Paper Aeroplanes, but I need to get some more music on here soon!)
You can even turn the volume up at the command line by typing
Next steps – playing MP3 files, internet radio (I’ve asked Santa for a PiFace display control gizmo – could be the start of a beautiful but of gadget making!), who knows?
I just made a quick and dirty command line internet radio that plays BBC Radio 6music and Radio 4 by installing mpd and mpc:
sudo apt-get install mpc mpd
and then adding the BBC 6music like this:
mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_6music_p?s=1365376386&e=1365390786&h=de40a9915206c4402c73e3766dc3fec0
adding BBC Radio 4 by typing
mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio4_p?s=1365376126&e=1365390526&h=ed9a0642b30c422b07fbcd8683c52335
and then typing
mpc play 1
for 6music (the first one I added),
mpc play 2 plays Radio 4. There are more BBC radio stations listed here.
Plenty more to do – get it to run at boot, controls, displays, a pretty box – but amazing how quickly you can turn a pile of rubbish into something useful like an internet radio.