Raspberry Pi as Music Streamer

Thanks to its small size and simple requirements, the Raspberry Pi can be transformed into a variety of different specialized devices. One such role that it can fill is that of a dedicated music streamer, or jukebox. Whether you have your own music files (MP3, FLAC, etc) already downloaded and want to stream them to speakers around the house, or you rely on streaming services like Spotify or Pandora, utilizing the Raspberry Pi as a music streamer is a great way to enjoy some tunes. In this tutorial, we will go over the step by step instructions to help you turn your Raspberry Pi into the ideal music streaming device.

In this tutorial you will learn:

  • Options and prerequisites for Raspberry Pi music streaming
  • How to install Logitech Media Server
  • How to configure Logitech Media Server
Raspberry Pi as Music Streamer
Raspberry Pi as Music Streamer
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Raspberry Pi
Software Logitech Media Server
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Audio Streaming Options and Prerequisites for Raspberry Pi



DID YOU KNOW?
You should know that there are a lot of ways to go about turning your Raspberry Pi into a music streaming device. We will be taking the most straightforward and universal approach, which should make this tutorial accessible to the largest number of readers.

Operating System
There are some specialized audio streaming operating systems available, but we will be sticking with the traditional Raspberry Pi OS in this guide. It will do the job just fine, and gives us a generalized operating system to fall back on in case we want to use the device for other kinds of tasks later on.

Streaming Software
As for streaming software, there are a plethora of choices. We will be using Logitech Media Server to host all of our music over the network, as it is an open source and highly compatible software that still receives updates and has been around long enough to establish a good track record. You can, of course, install other media streaming software alongside Logitech Media Server, or even substitute your own choice later on, if you prefer. The software you choose will mostly boil down to personal preference, but we feel that Logitech Media Server is a solid choice.

Other Requirements
The other things you need are fairly obvious: the Raspberry Pi needs to have a connection to your local network, and optionally the internet if you plan to stream online. You will need to plug in some speakers, and you will need to load up the Raspberry Pi SD card with all of your music files. You could also plug in a USB drive or similar storage device if you have the music files on there. For now, you will also need to be able to connect to the Raspberry Pi in order to install some software. You could do this with VNC preferably, or use SSH for command line access.

Prepare Raspberry Pi as Music Streamer

We will now go over the steps required to install Logitech Media Server, configure it as needed, and then begin using the Raspberry Pi as a dedicated music streaming device.

  1. On your Raspberry Pi, get started by navigating to the official download page for Logitech Media Server, and choose to download the Debian ARM version of the software.
    Downloading the Logitech Media Server software
    Downloading the Logitech Media Server software
  2. Next, navigate to the ~/Downloads directory and use the following command to install the software.
    $ cd ~/Downloads
    $ sudo apt install ./logitechmediaserver*.deb
    



  3. The Logitech Media Server will run as a service that can be controlled in systemd. To start the service, execute the following command:
    $ sudo systemctl start logitechmediaserver
    

    If you plan to use your Raspberry Pi solely as a music streamer (at least, for now), then it would also be beneficial to make the Logitech Media Server start up automatically upon subsequent system boots:

    $ sudo systemctl enable logitechmediaserver
    

    Keep in mind that you can check on the status of the service at any time with this command:

    $ sudo systemctl status logitechmediaserver
    

    We can see in the screenshot below that the service is currently running:

    Monitoring the Logitech Media Server service on the Raspberry Pi
    Monitoring the Logitech Media Server service on the Raspberry Pi
  4. Access the Logitech Media Server interface through web browser. The service runs on port 9000. If you are on the Raspberry Pi, you can enter http://localhost:9000 to get to the interface. If on some other device, then enter the IP address of the Raspberry Pi and :9000 at the end of it, to access the correct port.
    Accessing the media server login page
    Accessing the media server login page

    You may skip this login page if you wish. It is not necessary to make an account.

  5. Next, show the media server where you store your music library.
    Select the location of music library
    Select the location of music library
  6. Now you will be able to queue up songs and begin listening to music. Other devices running music players such as WinAmp or iTunes can access the Raspberry Pi’s stream through http://localhost:9000/stream.mp3. Note that localhost should be changed to the IP address of the Raspberry Pi on other devices.
    Music streaming interface
    Music streaming interface


Closing Thoughts

In this tutorial, we saw how to convert a Raspberry Pi into a music streaming device. Although many different softwares can be used for the task, Logitech Media Server manages our music library nicely and is able to serve out the stream to other devices over the network. The Raspberry Pi proves to be an inexpensive and easy option for hosting your own music stream.



Comments and Discussions
Linux Forum