Hawkwynd Radio

The story of a man who became obsessed with hosting his own radio station and how he achieved his objective.

Screenshot of Pandora display

I don’t know about you, but if I had it my way, free stuff would be free — of advertising! Then, it hit me! What if I could obtain some useful information about the song being played? What if I could access a database or API to get that information by simply providing the song title and name of the artist? What if I could get the album picture like the do on Pandora’s application? What if I could find out who was playing and singing and who wrote the song? What if I could get the label the album was released on and when it was released? What I could find out any more information about the artist and the release?
The questions began to build up — thus my quest continued to take new paths. And I became even more obsessed with my little project. Days passed like hours on the clock and often I found myself falling asleep at the keys as I dug into the nuts and bolts on how to achieve each little riddle.

Let’s Back up a little here..

I’ve always enjoyed listening to podcasts, and streaming audio and often found myself wondering “How do they do that?”. Then I began to think about what it would be like to be able to do that too, and wonder how ‘hard’ it be to actually host a live broadcast and send out my signal to the world. Thus, the seed was planted, and it grew (and how). I researched blogs, tutorials, websites, software and anything I could read about the topic of “Broadcasting on the Internet” and the more I read, the more intrigued I became — to the point of obsession. And, after a week or so, I set sail for the grand oceans of the unknown and embarked on an adventure which took me to places I never knew existed.

My love of music became widened by the love of the history of music and the vast myriad of people, artists, technicians, musicians and all the people who make the music as well as the industry’s role in keeping it all together. What follows is a relatively detailed account of my travels and tribulations as I navigated the unknown waters of internet radio broadcasting.

The Components of Hawkwynd Radio

This list makes up the services and applications I used to build Hawkwynd radio:

I’ve installed all the required web services, Apache, Mysql, MongoDB, etc. All the basic services to host a website and support PHP code.
Then, to be able to send a streaming audio signal, I installed a Shoutcast server set up from the instructions I found on this website. I could go into details about how I had to learn the AWS cloud architect best practices and EC-2 instances, and all the fun involved with that, but I’ll save that for another blog series. For now, I’ll just keep it simple and let you know that I have an Ubuntu server on an Ec-2 instance using Amazon Web Services as well as the Shoutcast software.

My Project Requirements

I wrote down a list of action items I wanted my project to perform:

  • Capture the results from Musicbrainz and store it in the MongoDB if it doesn’t exist. This reduces repeat calls for an Artist/Title to Musicbrainz and assures a faster response time when the next song is being played. Also, it assures data returned is consistently being presented.
  • For each Artist/Title query, I only wanted the FIRST recording, or the oldest release that recording is a part of. For example, Depeche Mode “Personal Jesus” first appeared on “Violator” in 1989.
  • Gather information about the release, from Wikipedia, if available.
  • Gather information about the artist, from Wikipedia, if available.
  • Capture the release (album) cover image to display on the page.
  • Capture the label the release was released by, as well as the year the release was released.
  • Capture the artists credits from the recording metadata, by instrument or vocal
  • Capture the release’s track list (all the songs on the album) in the proper order they appear.

At this point, I sat down (I was hardly standing, more like pacing about aimlessly in thought) and began building the request and search functions I needed to get my metadata. There are only 2 items I am using in my request:

In it’s simplest configuration, MIXX sends a string to the Shoutcast server to announce the song it’s playing, as well as the stream of music as it’s playing. Something like “The Beatles – Help!” as a single string. Easily configured in the Broadcast section of MIXXX. I will write a separate post regarding MIXXX soon, I promise.

The next step was to make a simple web player object on the web page, and then flesh it out with all the details. If you’re familiar with Pandora, Spotify and the bazillion other streamer services is they provide some

1
metadata

with the music being played, along with some relative content such as Artist info, links to learn more and buy the products they’re throwing at you in small little advertisement squares everywhere which do nothing but distract me from what I really want to read or see. What I wanted to achieve was a simple layout, with everything I needed in one screen.

As of this writing I am at version 1.0 beta release of Hawkwynd Radio. Here’s a breakdown of the page displaying during a song.

[1] The release cover image

I will be writing more about the process I use to get the image, which is hosted and stored by archive.org.

[2] Artist, Song Title, Release Title, Date of release and label

The process to retrieve the first release of the song being played cannot be explained in this page, so I am going to defer that for an entire series of posts and share code and stuff to give you more of detailed look at the inner workings and logic. For the laymen, the data is retrieved from an API provided by musicbrainz.org who have (IMHO) the most accurate collection of music in a single database. In fact, it is apparent that many of the service providers rely on musicbrainz to drive their applications. The metadata maintained by musicbrainz is handled by a large consortium of music enthusiasts, who I am proud to be a part of such a dynamic community of people.

[3] (if available) The instruments, and the artist playing it.

With many of the popular releases, additional metadata about a song (known as a recording), are available through the Musicbrainz API. Of that, the artists’ credits are often a very entertaining read, to learn more about that song. I only want the instruments, and vocals, but the API can provide all the credits, such as producers and engineers and the like.

[4] The list of songs on the release, in order.

It’s often handy to see the other songs which were on a release. For me, it gives me ideas for my playlists, and to remember back to the time I used to listen to a particular release when it first came out. This data is readily available through the API in a simple request.

[5] The Nerdly stats:

Total number of known titles in the database to date. The frequency and bitrate of the broadcast, service uptime and number of current listeners.

[6] Wikipedia data about the artist.

In most cases, the “Annotation” about the artist is linked to a WikiData object, which is then relative to the Wikipedia page that contains the output. Getting the extract content from wikipedia, I was able to truncate the content to a set of sentences, to prevent having a wall of text displayed.

[7] Wikipedia data about the release (if available)

Much in the same way the artist content is used, there is a wikidata object (on most but not all) release groups, and getting the content is very similar to that of getting the artists’ content, and truncated as well to prevent a wall of text.

 

[7] Song play history for the last 90 mins.

The song play history is a simple call to the ShoutCast server for the history, and it returns a string in Json format which is then populated in the history section. It’s function is merely to give me a look back at what’s been played – very helpful while I’m doing a live broadcast, to let me know if I’ve already played a particular song, so I can keep from repeating myself in my selection of music. I’ve been known to do that from time to time.