A few years ago I was regularly working in a university library that was almost, but not quite, silent. Silence can be a perfectly productive environment to work in, but almost-but-not-quite silence is gradually, inexorably, nerve-janglingly distracting. Every snap of a water bottle or whine of an overactive laptop fan would reliably derail whatever tentative train of thought I was following.
For years I had listened to thunderstorm recordings whenever I had trouble sleeping — something about that grumbling, thumping sound makes me feel safe and relaxed — so I tried filling my headphones with rain and thunder in the library. It worked. With a steady, homogeneous stream of ambient noise, the occasional chair creak or sibilant whisper stood out less and became a easier to ignore.
Later, I saw a site called Coffitivity on Hacker News that streamed the sounds of a coffee shop, and discovered that by layering coffee-shop-sounds with rain-sounds and thunder-sounds I could block out a wider spectrum of distracting noise.
And so A Soft Murmur was born, a site that streams different types of ambient sounds and allows you to mix their volumes together however you like.
I created the first version knowing very little about programming or audio editing. But editing audio with Audacity and playing it in the browser with HTML5 audio is extremely simple, and controlling the elements with jQuery didn’t take more than twenty minutes of light searching and some creative copy-pasting.
A few dozen revisions later and things were working well enough to demand a real user interface. My approach to design is usually to keep this as simple as possible, especially when working in a new field, so I decided to use large, flat controls and keep the interface black-and-white. Color was one less thing to think about and one less thing to get wrong. The only flourish I allowed myself was altering the opacity of the background image for each sound as the volume changed, so that fading the volume out would also fade the image out.
The first public version of A Soft Murmur had less than 150 lines of code and no logic more advanced than
var declarations and
if statements. It was only when early adopters began asking for new features – timers, saving and sharing mixes, more sounds – that the code base began to grow. But even then, there was very little that couldn’t be explained to a non-technical person in a few minutes.
Of course, the code was horrible. If I wanted to bind a function to the
timeupdate event of each audio player, I would select them by id one-by-one — then bind each with a single-use anonymous function with calls to more and more single-use functions,
fireCheckLoop(). It was less DRY than RYRY. Lurking somewhere in the version history, following the addition of some logic to break up the query string of URIs used to share mixes – a feature that came relatively late – is a comment which reads
//note to self: this is what an array is. But no-one seemed to mind, so long as it worked.
I’m happy to say I did eventually learn what an array is, along with objects, scopes, prototypes, closures, promises and so on. I also learned about domain sharding, systems administration and hosting an application that’s serves hundreds of terabytes of data. I even built an Android app, which led to learning lots and lots of other things.
I eventually gave up on the original black and white design in favor of one that was less, as a friend put it, “aggressively ugly”. I much prefer the new design, though I am sometimes nostalgic for the angular brutishishness of the original, just as I sometimes miss writing code without tests, design patterns or any real idea of what I’m doing. But the reward that let me push through the frustration and tedium of creating those early versions is the same reward that motivates me to improve as a programmer today — those rare moments when something finally works, and the lingering, sublime disbelief that a few lines of text can create something magical, seemingly from nothing.