Introducing Hum + Melody – Simple Music Streaming and (Web-)Client

Von Protonet Team. Veröffentlicht 5. September 2011.

When you have your own protonet-node and start putting all your stuff on there, there naturally comes a time when you decide that just storing your music on it is not enough, you also want to listen to that music, preferably from anywhere and with any device. Now since we haven’t got a third party app management (yet) you’ll have to do some package installing by hand.

There are a couple of great solution for being your own music hoster and with the hardware power that the node brings it’s not hard to just use one of the existing solutions:

  • Subsonic http://www.subsonic.org is a full fledged server and web client + there are quite a few smartphone clients out there, this is what I tried out.
  • Ampache http://ampache.org/ similar to Subsonic but the reviews weren’t as good as what people wrote on Subsonic, so I passed.
  • ORB http://www.orb.com/ this one looked nice on paper (or web) but didn’t seem to be Linux compatible (a deal breaker since the nodes run a ubuntu server version).

I am sure there are much more, feel free to post your feedback on anything you used and liked or disliked in the comments

After using Subsonic for a while I was mostly happy, there was however a main issue I had with it and that was that it wouldn’t allow me a jukebox style play of my entire collection. and while I was pondering that issue I was wondering why these players had to be this big and clunky. I thought that there certainly should be an easier player/client setup. A very simple server that just serves music and a simple client that allows you a simple way to play back that stuff.

I wanted …

  • a music server that just serves music
  • a music client that connect to any music server that follows a certain specification and plays/streams from the server
  • to have my whole music collection available to me wherever I am.
  • to be able to play random tracks from my entire collection without having to configure anything.
  • to be able to search my entire collection
  • to be able to queue tracks
  • to be able to view the tracks that have been previously played

Now apart from some other minor niceties I didn’t really expect much from a music player. Unfortunately I haven’t found anything like that, so What is a developer to do in such a situation. A developer develops!.

Welcome Melody & Hum

Melody

Melody is a music server that (at the moment) does three things

  • Announces that it is the melody sever
  • Publishes a list of all the music that it has in its catalogue
  • Serves a track requested

Besides this it also allows you to do a couple of other things in the background

  • Configure multiple music source locations
  • Index all the music from these configured locations

That is all it does, and maybe that is all it may ever do. But with just these three things it does about all it needs to do more or less, because less is more.

Hum

Hum is the client that talks to the melody server. So what can Hum do today? It might not be the prettiest looking player but it does do everything you would need in a player. Its features include:

  • Track Navigation (including smart skipping functions)
  • Random play from your entire music collection
  • Search for tracks, click on the track and play it
  • Queuing. Queue tracks from which you have searched
  • Previous list. Show a list of all your tracks to which you have listened, play them again or queue them to play later
  • Volume. Independent volume control so you can control how loud your music is.
  • Continuous play. Choose whether you want a next track to be loaded when the current track finishes or if it should just stop.
  • Duration. Shows how much of the current track has been played, as well as the total length of the track
  • ID3 information, if the track has it, it will be displayed
  • Configurable server location. Choose to which Melody server you want to connect. Or any other music server that behaves like Melody.
  • Fetch a new catalogue from the sever
  • Re-index the tracks on the local client.

Code and Tech

The code for melody is located at https://github.com/protonet/melody .

It is a super simple Sinatra app. The main work happens in three files, and I think it is pretty easy to read, so I don’t think I need to expand on it here.

Hum lives here: https://github.com/protonet/hum .Unlike Melody, Hum is a full Rails 3 application, as it needs to do a bit more than what Melody does. Apart from just Rails the other main component to Hum, is Soundmanager2 (http://www.schillmania.com/projects/soundmanager2/), without which, Hum as it is now would not be a possibility. Its API is great and extensive, and allows you to do just about anything with it. And the two main things that it does that is needed in Hum are

  • Hit a URL and play whatever that URL returns if it can
  • Fire a JavaScript callback event when it has finished playing a track.

What this means is that we can pass something like this to SoundManager 2 and it will just play, as long as it returns a playable file.

http://melodyserver_url/3y83ekkusahdua3e313

Other things we used to get Hum working the way it does

  • jQuery – What can I say about this. Just the best of the best.
  • Head.js Allows you to put JavaScript back in the head tag where it belongs, and downloads the js files in parallel
  • facebox – A light-box for programmers
  • Memcached – in memory cache to speeds everything up a lot and is actually required for some of the parts of Hum to work.

Finally

What this means is that you can have your entire music collection available to you wherever you go, as long the server is accessible to you where you are. That could be on the internet, or on a LAN if you don’t need it accessible to the outside world or wherever. It is up to you.

If you would like Melody or Hum to do more, let us know, or fork them, modify them, and make a pull request.

What does this mean for Protonet? It means that not only will you be able to have your Protonet node with all the goodies that it provides, but now you will be able to have it configured to be a music client/server as well. Melody and Hum are likely to be the first of the third party apps integrated into Protonet. We will give you a simple interface to install and configure both Melody and Server. With Hum/Melody, what was great in Protonet is about to get better.

Go ahead, Hum a Melody 😉