As part of my Christmas gift to my girlfriend, Rachel, I wanted to do something interesting with technology – specifically the many devices I have at my disposal.
What I ended up building was a “symphony” with multiple phones, tablets, desktops, etc… playing different parts of a song Carol of the Bells.
EDIT: Node server taken down for now…
Try it out here
This is the version where every device plays the same part – it’s a bit more visually pleasing than it’s ensemble counterpart:
And the ensemble version where there are four parts split between the devices:
This was hacked up on Christmas Eve, but if you want to dig through the code, it’s on GitHub.
The client connects to a Node.js backend which lets the clients know which audio file to use. Once the sound files are loaded on all clients, an event to play the audio files is sent out (adjusted for latency on each device). The only painful thing here was some of the differences in HTML5 audio implementations on each device… it was easy enough to get the audio files to play, but there were different delays when using audio.play() or audio.currentTime = 0 (and Web Audio isn’t supported enough on mobile).
The four mp3 files are generated from a Carol of the Bells MIDI. To add in the visuals, I converted the MIDI file to an XML format, and again to JSON keeping just the info I needed (when a note is played, and which note).