Just when your RaspberryPi is lurking in StandBy most of the day, it makes sense to give him other tasks than originally planned.
This is the case, for example, with the RaspberryPi I use for my MagicMirror. This takes over in the bathroom, the display of current content for my MagicMirror. In addition to this task, he does not really have much to do. So I came to the first thought: Why not use the RaspberryPi as Internet radio? Brushing your teeth, taking a shower, etc. are definitely more fun with music.
In search of a suitable solution for the integration of an internet radio, I soon came across the possibility of extending the RaspberryPis functionality with a DLNA streaming client.
All you have to do is connect an active speaker to the RasperryPi and install and configure the appropriate software.
How to do it and what you have to pay attention to is described in the following article.
Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section.
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂
- 1 Safety instructions
- 2 Requirements
- 3 Log in via SSH on the RaspberryPi
- 4 Update package management
- 5 Install the required packages
- 6 Create folders and clone software from a GIT repository
- 7 Perform automatic configuration
- 8 Build or compile software
- 9 Setting the audio sources
- 10 Set Alsamixer volume
- 11 Set autostart of the software
- 12 Take a first test
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/sicherheitshinweise/
To be able to install a DLNA client on your RaspberryPi’s, it should be prepared so that you can access it via SSH.
The following three articles describe what to do to prepare the RaspberryPi:
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The first configuration
RaspberryPi – Controlling the RaspberryPi via SSH
In the following list you will find all the parts you need to implement this article.
Log in via SSH on the RaspberryPi
To get started, you first need to log in to RasPi with SSH on Putty. How to do it is described in the article RaspberryPi - Controlling the RaspberryPi via SSH.
Update package management
The package management in Linux is a "central point" over which various software packages can be installed. For this to work reliably, the lists and sources of package management should be updated before installing any new packages.
sudo apt-get update && sudo apt-get upgrade
Install the required packages
sudo apt-get install libupnp-dev libgstreamer1.0-dev gstreamer1.0-libav gstreamer1.0-plugins-* -y
sudo apt-get install gstreamer0.10-plugins-* pulseaudio -y
Create folders and clone software from a GIT repository
Now you have to load the actual program files of the “gmrender” from the corresponding GitHub.
git clone https://github.com/hzeller/gmrender-resurrect.git
Perform automatic configuration
In this step, you will need to run some of the included configuration scripts.
Build or compile software
This step is about compiling and installing the “gmrender”.
sudo make install
Setting the audio sources
gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosink pulsesink
gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosrc pulsesrc
gconftool-2 -t string --set /system/gstreamer/0.10/default/musicaudiosink pulsesink
Set Alsamixer volume
In this step, you “spin” the output volume of the Raspberry Pi to the maximum level. Do not worry: the volume can be adjusted later via the “Music Channel”. So that you also have the maximum available volume range available, it makes sense to adjust the RaspberryPi to the maximum volume.
Set autostart of the software
In order for the DLNA client to start automatically the next time you start the RaspberryPi, you can enable the autostart.
sudo crontab -e
@reboot pulseaudio --start @reboot /home/pi/dlnaClient/gmrender-resurrect/src/gmediarender -f "RaspiDlna"
Take a first test
Thanks to the standardization, you can feed the installed DLNA client from different sources. One possibility is to use a smartphone with the right app.
An app for Android that works well can be found in the PlayStore under “Hi-Fi Cast Music Player”. There are also apps for Apple devices. Look for apps that support DLNA or UPNP. With one of these apps you can now test the output on the RaspberryPi.
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂