Occasionally I make the effort to write some code. One thing I wanted to try was a browser-based audio improvisation tool. Something very simple and lightweight, otherwise I may as well just fire up Ableton.
The original idea was to display an array of samples that could be triggered asynchronously and made to loop, as required. The screen capture you see above is pretty much how I imagined it would look. Each big square has a sample assigned to it. Click the square and the sample plays. It got called MUKEBOX because, it’s sort’ve like a jukebox and my solo ‘music’ project is MUTATE… see? A true original thinker.
Techy time. So, I wanted to playback several samples asynchronously, from a browser. A little research and I found that I could utilise the vaguely supported HTML5 audio routines to do this. With a little help from some multi-channel example code published by Thomas Sturm, I expanded, threw a GUI together and quickly recorded some audio to take the samples from.
Limitations so far: Hmmm. Well. OK, so HTML5 audio is vaguely supported. Firefox does a great job of rendering MUKEBOX – once the samples have loaded, they can all be triggered, with 16 audio channels being available. Samples are stacked on top of each other to play from start to finish, until the channels are all busy. So, you can playback one of the samples sixteen times if you like – just click it a load of times. Sixteen instances will be played, layered on top of each other, each sample playing from its’ beginning at the point in time at which you clicked, until its’ end. It doesn’t work for me in Chrome. Which is sad ‘cos I like Chrome. Other browser support is, well, vague. Try it.
The other biggie is that HTML5 audio support is problematic when it comes to the MP3 format. Google it – I can’t be bothered to explain. So all the samples are WAV’s. Which are obviously bigger than MP3’s and so I had to take the decision of not using really long pieces of audio. To limit filesize, each sample is approximately 30 seconds long and mono. Of course, if ran locally, the WAV’s can be as long as one likes, in luscious stereo, but for on-line use I wanted to be realistic. When on-line, one has to wait a while for eight 30 second WAV’s to load. I may well make the off-line version available to download at some point. If enough people ask, I’ll make the effort.
Future: I haven’t managed to get the samples to loop yet, but I will do at some point. There are some other tweaks I’d like to add, such as visual feedback denoting that a sample is playing and maybe even a progress bar of some sort for each sample. But then, maybe that would spoil some of the ‘chance element’ you get with this current version. As a tool, it’s pretty effective and useful in the live environment. It’s also not a major resource soak, so a lot can be done with little – a recurring interest of mine.
Please, go play with the MUKEBOX. Feedback is very welcome!