Internet Radio Station 101

Do you want to create your own personal jukebox that broadcasts to the entire world (or just your home/work network)? Then an internet radio station might be just right for you.

An internet radio station is nothing but a live stream of audio that is being sent by a source on one end (the server) and listened to by an audio player on the other end (the client). To give you an idea of how this would look like in the real world here is an example.

Click play in the audio player below:

This might look like just any other mp3 that you listen to online. But if you listen closely, you will see that it is actually a live audio stream and not a pre-recorded audio file that is playing. If you don’t believe me, try refreshing this page and then click on play again. You will see that the audio will not start over, but instead play as if there was no interruption. You will also not be able to forward or rewind the audio by moving the slider.

If you look at it, it is pretty cool that you can actually listen to a live audio stream in a plain WordPress site. The reason I can do this is that, listening to a live audio stream is no different than listening to pre-recorded audio. The only difference is that in the case of pre-recorded audio, you are streaming bytes from an audio file (local or remote), and in the case of live audio, you are streaming bytes from a streaming media server.

Having this basic knowledge of how an internet radio looks like on the client-side, let us take of the hood and see how it works on the inside.

An example of a basic Internet Radio Station setup

An internet radio system comprises of three actors:

1. Source client

By the name, the source client is the software that reads the source audio from an input device or an audio file and transmits it to the streaming media server.

Some examples of source clients would be Winamp, VLC, Mixxx, DarkIce, Ices, and of course the famous liquidsoap. All of these are pretty much just programs that record audio from an audio interface, encode it and send it to the streaming server.

There are two types of audio inputs that can be read by the source client:

  1. Live input (from a microphone)
  2. From an audio file

Either of the inputs can be used based on the nature of the radio station. And of course you could switch from one input to the other while on the air.

Although the source client directly sends an audio stream to the streaming media server, it doesn’t need to reside on the same server as the streaming media server.

2. Streaming Media Server

When it comes to streaming media servers, the most popular option is Icecast.

The Icecast Admin Portal

Icecast is a streaming media (audio/video) server which currently supports Ogg (Vorbis and Theora), Opus, WebM and MP3 streams.
It can be used to create an Internet radio station or a privately running jukebox and many things in between. It is very versatile in that new formats can be added relatively easily and supports open standards for communication and interaction.

Icecast is distributed under the GNU GPL, version 2.

The role of a streaming media server (i.e. Icecast here) is to relay the audio stream from the source client and serve it to the outside world. You might ask why we would need an extra layer, when we can directly serve the audio stream to the outside world right from the source. The reason for this is to eliminate the bottleneck at the source.

A bottleneck

Whenever a listener tunes in to listen to the internet radio, a stream request is made from the client to the server, after which the server keeps sending the client a stream of bytes.

The problem is that, if the source client directly streams to the end-user, then it has to take the job of sending each user its own audio stream. This would cause a bottleneck on the source client.

“How?” you might ask.

The source client has to read from the audio interface and also send it to the end-user. A server can only read so much of data from a disk at a time. If there is a lot of load put on the source client, then it would eventually overload. If the source client were to crash because of the overload then it would affect the streams of all of its listeners.

By adding an extra layer we are not only taking off the load from the source client, but also adding the ability to add load balancing to this middle layer. There can be multiple instances of the Icecast server all being load balanced by a docker swarm. There will only be one stream from the source client to any single instance of the Icecast server. The Icecast server will in turn serve the stream to thousands of users around the world.

A single Icecast server can support multiple Source clients that send streams to different mountpoints

The Icecast server can also serve multiple streams from different source clients, or different versions of the stream in different formats or bitrates. Each of these versions are called mountpoints, and each of these mountpoints have a streaming url.

3. Client (the audio player)

An Internet Radio player does not require any special audio player library to be played. Any audio player that can play from a remote audio file can also play from a live stream (as long as the player supports the format of the audio being streamed i.e. mp3, ogg etc…). All you would need is the streaming url of the station, which you should provide as the source to the audio player.

Each mountpoint has its own streaming url

The streaming url can be found in the Icecast admin portal, next to its corresponding mountpoint. When you enter a streaming url in the browser, a simple audio player will be displayed, which would play the live audio stream.

A very popular JQuery HTML5 multimedia library

However this doesn’t mean that you cannot create your own UI to display the players that play these streams. You could create a custom widget with libraries like jPlayer and add it to your blog or website. The possibilities are endless.


Having said all this, there are a lot of things to know about Internet Radio Stations, starting from their usecases right to the technical nuances that goes behind creating a perfect system. But sadly all of these cannot be written in a single blog post. So hoping you’ve got a basic understanding about internet radio stations, let me follow up later with a different post on this topic.

Until next time!

One thought on “Internet Radio Station 101

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.