reprage

I spent last weekend at the excellent CampJS, with my good friend Paul Theriault who works for Mozilla securing FirefoxOS. We spent much of the weekend turning FirefoxOS mobile devices into a collaborative, location-based musical instrument: Cowboy Jukebox.

The premise of Cowboy Jukebox is fairly simple: you and your other ‘band members’ are carrying mobile devices, each a small piece of a larger globally distributed ‘musical instrument’. By tracking the location of each device via GPS, the whole instrument produces different sounds based on band members’ locations. All participants share the same auditory experience, and any band member can twist and change what the others can hear.

We still have more work to round out the build. But, thanks to the insanely awesome work that the folk at Mozilla have put into FirefoxOS (more on that later), it should work on any mobile device with a modern browser.

Cowboy Jukebox is broken down into two main components:

A lightweight server built in Ruby on Rails, and running on Heroku. This setup gathered and distributed the GPS coordinates of all the band members via JSON. You can find the source for the server lurking over on github.

A Javascript client that can poll inbuilt location services using the HTML5 geolocation API, and send this to the server, grabbing the latest locations of all the band members simultaneously.

The locations of all the band members are then processed to obtain the total distance moved (along with changes in latitude and longitude), and used to synthesize sound using the awesome library timbre.js. The source code for the client is also on github

Seeing as FirefoxOS is literally a web browser whereby all apps are identical to applications built for the web, to allow installation we simply created a manifest file. This was dropped into the FirefoxOS simulator and we were away, riding the crimson fox to bleeping and blooping freedom.

In the past, I have done a reasonable amount of Android development building a few different site specific theatrical works using cheap handsets, GPS and a chunk of Java.

Wow. Not only is developing for FirefoxOS a breath of fresh air, but, for handsets in the sub $100 range, FirefoxOS powered devices are simply amazing. The user experience is almost on par with a high-end handset like the Nexus 4 or Apple’s iPhone 5, and completely overshadows a sub-$100 Android phone. I am also a little attached to the brightly coloured cases that I lovingly dubbed ‘borange’.

As with everything else when developing software, it wasn’t all happy days. We ran into a few little stumbling blocks while hacking away on the devices:

  • When ‘pushing’ the app to the device, the icon would often not appear on the homepage along with all the other apps. The app had still been pushed to the device, but still required a search on the phone to find it.
  • Had a few minor jittering issues with buffering sound on the device. We might have been pushing these handsets to the limit, or just need to tweak timbre.js a bit.
  • ‘Curling’ or accessing remote JSON sources felt a little clumsy. Considering everything is running in a browser on FirefoxOS, we had to work on the server a bit to get around the XHR same origin policy. While this makes sense for ‘regular’ browsers, I felt it was a little restrictive considering apps running on FirefoxOS are almost never going to be from the same origin.
  • I missed being able to debug directly on the device. Debugging on the simulator is good, as is being able to use the developer tools built into Chrome and Firefox (P.S. the dev tools in Firefox have really caught up on Chrome). Still, for a few things, like the jittery audio, it would have been great to access handset debug info from within the FirefoxOS simulator / dev tools.

Minor quibbles aside, Mozilla should take a bow. They have done really fantastic work on FirefoxOS, and with awesome handsets available for less than $100, I think they are going to be a great option for new media artists working with mobile phones. I can’t wait for them to become more widely available and to work with them again.

PS - No payment was received from Mozilla in writing this post (though I wouldn’t say no to a handset!)

Comments:

You can join the conversation on Twitter or Instagram

Become a Patreon to get early and behind-the-scenes access along with email notifications for each new post.