One of the key features of Beats Per Mile was the ability to listen to a ‘stream’ of Gemma’s iPod playlist, enabling you to hear exactly what she was listening to whenever you logged on.

We didn’t actually have a stream broadcasting from her iPod of course, rather a stream playing from the site that was synchronised with her start time.

We planned on using the SoundCloud API to do this and it was one of the last thing left to build before race day.

Part of the playlist was curated by friends, donated tracks with sentimental value or just old favourites for a personal touch and to provide an extra kick of motivation.

Asking a lot of people for contributions meant that the playlist wasn’t finalised and mixed until very late on — Saturday evening.

I created the player using the SoundCloud Player Widget in preparation for the tracks hoping that the player would be ready before they were uploaded.

It’s a Javascript-enhanced Flash Widget which uses Actionscript’s ExternalInterface to expose method handlers and control playback via a in-built API.

Unfortunately this meant it wouldn’t play on the iPhone. SoundCloud do offer a HTML5-based Custom Player (which falls back to Flash), but we didn’t have time to fully investigate wrangling together a player from scratch.

SoundCloud Content Identification

This would be shortly be rendered irrelevant when we discovered that it is now nearly impossible to upload any copyrighted songs, or tracks containing any samples of copyrighted songs, to SoundCloud. We also discovered that they’re very, very clever in how they go about detecting them.

Here’s what they wrote in January:

Starting in the last few weeks we’ve turned on an automatic content identification system, similar to those used on other major media sharing sites. The system is used primarily for identifying audio that rightsholders have requested to be taken off SoundCloud. This is good news because it makes it easier for artists, labels and other content owners to control how the content they’ve created is available. And when you upload your own audio to SoundCloud, we can find out more quickly if somebody is uploading a copy to their own page without your permission.

SoundCloud have always has the right to remove audio deemed in violation of rights as stipulated in their terms of use. They also host plenty of mixes and DJ sets as many other similar sites do.

When we tried to upload ours though, nothing would work. None of our mixes were authorised and the refusals would come after spending considerable (precious) time attempting to upload them.

SoundCloud are essentially performing some kind of wave form analysis, comparing uploads to audio already in their databases to detect duplicates.

Alternatives

There are a few ropey ways to (possibly) slip the net, such as adding a layer of low-level noise to distort the wave form or apply an amount of time-stretching (which was happening anyway, as songs were mixed together).

Too much of either would ruin the music. We were running out of time and didn’t want to risk any hacked attempt being found later and removed, perhaps mid-marathon in a worst case scenario.

So I began to an attempt to recreate the widget, from scratch after all.

I looked at the Yahoo! Media Player, which is actually suspiciously similar to SoundCloud’s Widget API. The methods are almost exactly the same, but I had trouble handling multiple files — it really wasn’t anywhere near as easy to implement.

After browsing for alteratives I eventually found JPlayer, a very simple and easily customisable JQuery plug-in. This would also mean we’d be iPhone-compatible.

It also meant that the files would need to be hosted ourselves, on a normal server, rather than letting SoundCloud handle the load — another reason for our initial choice. We actually ended up serving 7.68GB of streamed audio, fortunately my host is very stable and it didn’t end up being a problem.

When visitors landed on the page the player would calculate how long the run had been in progress and therefore where you should be in the playlist. The idea was to give no controls, other than mute, the playback would always be synchronised.

Rather than upload all the songs individually, the playlist was divded into five 30-60ish minute tracks and would be easier to navigate.

Once the player determined what track you should be on and where within that the playhead should be, it begins to buffer. Annoyingly, you could have been waiting some time. If the tracks were on SoundCloud’s giant servers then the audio would be properly streamed, but not from mine.

The wait entirely depended on when you happened to arrive, for some it wasn’t a problem. Say you luckily arrived at the page needing only to jump in five minutes on the current track, you’d have a small waiting time. If the jump was twenty-five minutes, then start twiddling your thumbs.

There wasn’t a wait when the player switched between tracks. If a track was paused, the player would record how long for and resume at a later point — where the playhead would otherwise be if you hadn’t paused, not where you left off.

This also took into account track changes if you paused toward the end of a track or paused for more than the duration of an entire part.

Back to the Cloud

SoundCloud have an obligation to artists and labels and choose to be very strict in authorising uploads that aren’t your own. I’ve wondered how copyright works for these sites, Mixcloud for example host countless mixed songs and sets.

Mixcloud in fact is where you’ll now find the mixes saved indefinitely, without complaint, on Gemma’s page.

Have a listen!

Marathon Mix – Part One
Marathon Mix – Part Two
Marathon Mix – Part Three
Marathon Mix – Part Four
Marathon Mix – Part Five

But till then, tramps like us..