Listen webradio with Raspberry Pi

A Raspberry Pi with Debian can be used without a monitor to listen to your favorite web radio station in a continuous operation.

Using Debian

Download the latest version of Raspbian from and extract the zip file. The Debian image is copied to a SD card using the linux command line:

sudo dd bs=4M if=2014-06-20-wheezy-raspbian.img of=/dev/mmcblk0

While the copy process there is no visual feedback of the progress. To see this one can run the following command into an other terminal window:

sudo pkill -USR1 -n -x dd

Instructions for other operating systems are described at: Writing an image to the SD card.

Now insert the SD card into your Raspberry Pi, connect the Power and Ethernet cable. Also connect the Raspberry Pi using a 3.5 mm cable to your radio through the AUX input.

Now login into your Pi through SSH using the default user pi and password raspberry to make the base configuration and a system update:

sudo raspi-config
sudo apt-get update
sudo apt-get upgrade

Optional: free up 1 GB
By removing the Light Display Manager (lightdm) and all X11 libraries, one could free up to 1 GB of space. Be careful! The will remove the graphical interface:

sudo apt-get remove --auto-remove --purge libx11-.*
sudo apt-get autoremove

Option 1: Install radio tools

Now the needed tools mplayer and radio from the Python Package Index could be installed:

sudo apt-get install mplayer python-pip
pip install --user radio

For a simpler handling the file .bashrc could be changed. Put the following line at the end:

export PATH=$PATH:/home/pi/.local/bin

Save your changes, close the file and execute and check the changes:

. .bashrc
echo $PATH

Option 1: Listen web radio

Through the "radio" command the web radio is now accessible. To listen to the Trance channel of (and extract the real stream) the following comand could be used:

wget -O -
radio --add di-trance ""
radio di-trance

Useful mplayer commands:

q quit
9/0 lower/higher volume

maximize alsa sound output:

amixer cset numid=1 -- 400

Option 1: Run radio in background

So that the radio continues even after logout or closing the terminal, the program "screen" can be used.

sudo apt-get install screen

Useful screen commands:

Ctrl-A C new Window
Ctrl-A N next Window
Ctrl-A D detach

Later, the session can be re-attached via

screen -r

Option 2: Run radio at startup (wheezy)

sudo apt-get install mplayer

Instead of using screen, you can add the following line into /etc/inittab to start the webradio at startup and restart automatically if it has crashed, for example, by a disconnect:

ra:2:respawn:/usr/bin/mplayer -nolirc -ao alsa -vo null -really-quiet

About admirableadmin

Hello World! I am Andreas Peichert develop and program software since 2000. Currently I am working as an Open Source Software Engineer.

0 Responses to “Listen webradio with Raspberry Pi”

  • No Comments

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.