Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/w3348378/domains/sjriek.nl/public_html/wp-includes/class-wp-hook.php on line 298

Internet Radio (headless)

Turn a raspberry pi model b into a streaming radio player that can be controlled by MPD apps such as the IOS app MPoD.

This is based off the Raspbian “Wheezy” image found here: http://www.raspberrypi.org/

– Install the image on your SD card.

– ssh into your raspberry pi.

Username: pi

Password: raspberry

– If you have not already done so at the console, enter the initial config program

sudo raspi-config

  • Expand the file system

  • Set Hostname to piradio or whatever you want

  • Change the password if you want

  • Go to the Advanced options

    • Enable SSH

    • Update tool

    • Exit to command line

– Update and Upgrade Firmware

  •  Update all Raspbian packages.
sudo apt-get -y update
sudo apt-get -y upgrade
  • Install rpi-update

sudo apt-get install -y git-core
sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update
sudo chmod +x /usr/bin/rpi-update

  • Backup the existing firmware.

sudo cp /boot/start.elf /boot/start.elf.knowngood

  • Update to the latest firmware and activate it.

sudo rpi-update sudo shutdown -r now

 

– Install Audio and MPC/MPD

  • Install Audio

sudo apt-get -y install alsa-utils mpg321 lame sudo modprobe snd-bcm2835

  • Set audio output to analog (0=auto, 1=analog, 2=HDMI)# in this example the “1? is the option you would change to 2 if you wanted to use the HDMI jack

sudo amixer cset numid=3 1

  • Test Audio

aplay /usr/share/sounds/alsa/Front_Center.wav
speaker-test -t sine -f 440 -c 2 -s 1

  • Install MPD and MPC audio players

sudo apt-get install -y mpd mpc
sudo service mpd stop
sudo chmod -R g+w /var/lib/mpd
sudo chmod -R g+w /var/run/mpd

  • remove bind to address
sudo nano /etc/mpd.conf
  • Find the line that says bind_to_address “localhost”,  and put a # in front of it or remove the entire line

ctrl-x Y Enter

  • reboot

sudo shutdown -r now

 

– Add one or multiple radio streams and MPC Play Command

mpc add http://www.radioparadise.com/m3u/mp3-192.m3u
  • Start radio when pi turns on
sudo nano /etc/rc.local
  • At the bottom add the following line
mpc play
ctrl-x Y Enter
  • Manually start the stream

MPC play

– Setup your mobile device

  • Install a free MPD app on your mobile device such as MPod on IOS or MPDroid on android. No username/password needed.
  • If it does not automatically find the device, manually add one using the above HOSTNAME or IP address. I recommend the HOSTNAME as the current setup for IP is DHCP and your IP could possibly change.

Notes: Although it is set to automatically start, sometimes it will not. The simple solution is to just open your mobile app and wait for it to say the station is available and hit play.If you want to control the player from CLI:

MPC
MPC play
MPC stop
MPC help