This is an update for the older post with Debian Wheezy on how to setup a Raspberry Pi with Raspbian Debian Jessie in order listen webradio.
Getting Raspbian
Download Raspian Lite, extract the zip file and copy the image onto your microSD card using the linux command line:
unzip 2016-09-23-raspbian-jessie-lite.zip
sudo dd bs=4M if=2016-09-23-raspbian-jessie-lite.img of=/dev/mmcblk0 status=progress
sudo sync
The Lite version is already very slim, so there is no need to remove unneeded packages later, i.e. a X11 server is not necessary for headless running.
Instructions for other operating systems are described at: Writing an image to the SD card.
Initial Setup
Insert the SD card into your Raspberry Pi, connect the Power and Ethernet cable. Raspian will get a IP through DHCP, so login into your Pi by SSH using the default user pi and password raspberry to make the base configuration and a system update:
sudo raspi-config
Now expand the filesystem, set a new password, run internationalization options, change the hostname in the advanced settings and reboot.
After that install the latest updates:
sudo apt update
sudo apt upgrade
Webradio Setup
Connect the Raspberry Pi using a 3.5 mm cable to your radio through the AUX input and install Mplayer:
sudo apt install mplayer2
To test your setup with you favorite webradio stream url. In my case sunshine live:
mplayer http://stream.sunshine-live.de/hq/mp3-128/Facebook-og-audio-tag/
Useful mplayer commands:
9/0 -> lower/higher volume
q -> quit
Maximize alsa sound output:
amixer cset numid=1 -- 400
Run webradio at startup with Debian Jessie
The old /etc/inittab from wheezy does not work any more, because SysV is replaced by systemd as init system in jessie.
Create a new file i.e. /etc/systemd/system/mplayer2.service
[Unit]
Desription=mplayer with systemd respawn
After=network.target
[Service]
ExecStart=/usr/bin/mplayer -nolirc -ao alsa -vo null -really-quiet http://stream.sunshine-live.de/hq/mp3-128/Facebook-og-audio-tag/
Restart=always
[Install]
WantedBy=multi-user.target
and activate it
sudo systemctl enable mplayer2.service
reboot or start it manually
sudo systemctl daemon-reload
sudo systemctl start mplayer2.service