Create an Internet Radio Station With Your Raspberry Pi

Streaming audio can be as simple as connecting your smartphone to Wi-Fi, AirPlay, or Bluetooth connected speakers within your home. When you get that itch to dust off your DJ equipment and spin records at a private event, your Raspberry Pi can help you stream those epic cross-fades and record scratches all over your home.


For loved ones who decline your party RVSP, you can include them too by broadcasting the audio over the web. All you need is “butt” (broadcast using this tool) and Icecast 2 to make this music dream come true.


Getting Ready

The following items are required to get your audio streaming at home (or across the web) up and running:

  • Raspberry Pi 3 or 4
  • microSD card (8GB or higher)
  • An audio device that connects to a USB port (eg mixer, USB sound card, DJ controller, Bluetooth dongle)
  • butt software (streaming tool)
  • Icecast 2 (sends audio from your Raspberry Pi to your LAN or public internet)
  • Raspberry Pi OS (32- or 64-bit)

You’ll first need to install Raspberry Pi OS. For help with this task, check out our Raspberry Pi OS installer guide. If you prefer, you can install an alternative Linux OS; however, this guide is tailored to Linux distributions that include the APT software installer.

When you have your OS sorted, butt (broadcast using this tool) can be installed next. Butt is a lightweight application that will stream audio from a Raspberry Pi audio source connected to one of its USB ports. Note that this application is not designed to stream MP3 (or similar) audio files.

Let’s install the dependencies in order to handle various streaming codecs, using the following command:

sudo apt install -y libfltk1.3-dev portaudio19-dev libopus-dev libmp3lame-dev libvorbis-dev libogg-dev libflac-dev libfdk-aac-dev libdbus-1-dev libsamplerate0-dev libssl-dev libcurl4-openssl-dev

The dependencies include audio file types such as LAME, ORB, OGG, FLAC, AAC, and more. Once those media types are installed, grab a copy of the butt streaming tool from the SourceForge site. Then open a terminal window, and use the following tar command to extract from source:

tar -xzf butt-<version>.tar.gz

Navigate to the extracted files and create the application from the source files with the following:

cd butt-<version>
./configure --with-client
make
sudo make install

Most times Linux software has a package already assembled. In this case, the above commands enable you to build a package from the source files.

Set Permissions for Butt

Before you run the application, you will want to give yourself sufficient permissions. (Alternatively, you can use elevated permissions with the “sudo” prefix to run it, but that is not recommended.) Not sure where butt is located? In your terminal, simply type:

whereis butt

Move to the directory where the butt application is located:

cd /usr/local/bin

Give yourself the application permission required:

sudo chown [your username] butt

To run the streaming tool, type:

butt

Adjust the Settings for Butt

When the application opens, you will need to modify part of the configuration. choose Settings and then select ADD to fill in the server details that butt can pass to the Icecast application.

Ensuring that all the butt server details are completed before installing Icecast will ensure a smooth operation. Before you press ADDremember to select the radio button beside icecast as well. You’ll also find (within the Settings menu) an area to fill out detailed server information.

the URL can be left blank, or you can add something specific (depending on your needs). As well, it’s up to you if you want your music to be listed on the Icecast directory. If so, check the box beside Make server public. When you’re happy with your server info details, tap the ADD button.

The butt UI also includes some additional settings where you may select the audio source and some optional enhancements when displaying information about the music played on your stream.

Icecast Installation

This part of the process is fairly straightforward (thanks to a package being available using the APT installer). Hop into the terminal and type:

sudo apt install -y icecast2

You’ll notice a configuration window popping up soon after the installation finishes.

After choosing yes to move on from the first page of the Icecast configuration, you’ll be asked for passwords and related admin-related details. Although the prompts will guide you through these intuitive steps, ensure to make a note of the passwords you’ve selected. As the butt program is still open, press the play button to start sending your audio out to the internet.

You can also load up a web browser, on another computer connected to your local network, and type in [Raspberry_Pi_IP_address]:8000. This will load up the administration, statusand Version tabs within the Icecast web controller. To confirm the address of your Raspberry Pi, open a terminal window and type:

ifconfig

If you have everything set up correctly, you’ll see expanded details related to your streaming server.

To ensure that your streaming server is playing as expected, choose one of the options in the top-right of this page: M3U, XSPF, or VCLT. You can also point a new browser tab to http://192.168.1.XXX:8000/stream to start listening!

Expanding Stream Capabilities

With your music stream up and running, what will you do with your new capabilities? If you’d like to stream music beyond your local network, consider connecting to a free dynamic DNS tool. After you’re set up with a DDNS service, simply change the URL that your Icecast stream is referencing in order to broadcast your stream across the globe.

If you want to take this stream to the level of an automated internet radio station, then check out Open Broadcaster. This free software is great for enthusiasts, non-profit organizations, or low-budget entities that wish to share their thoughts with the world.

Add Optional Video Content

Although the possibilities are only limited by your imagination, many hobbyists and professionals have created video content (some as their main source of income) using YouTube. All you need is a Raspberry Pi 3 or 4, an attached camera, and some basic understanding of the Linux terminal. From there, you’ll be able to easily find ways to stream video and audio with almost any budget in mind.

Why not give it a try? With audio streaming, automation software, and a video feed, you’ll have a professional-looking studio streamed to the world. Pretty cool, right?

Leave a Comment

Your email address will not be published.