Calm

link
07/2020
Android | App | C++ | GLSL | Java | Oboe

Hi. It's been a while.

TL;WR? I made an app called Calm and set up a Quieter place.

For some reason 2020 seemed like a good year to make a relaxing app, and with a downturn in client work, I was lucky enough to have the time to do so.

About Calm | quieter.net/calm
Why Quieter? | quieter.net/shhh

Check the links above for some succinct information about Calm and Quieter, or continue reading below as I ramble briefly about some of the app development.

Trouble Sleeping

I think my wife has always liked to have a bit of background noise to fall asleep to. Some music, a film, a thunderstorm; anything that lets the mind wander and helps temporarily block outside distractions - and that was main the inspiration for this app…

Though I also had an itch to get back into some audio synthesis / dsp programming - it's been too long - so making an something that generates ambient soundscapes seemed like it would tick all the boxes...

Well, almost all. I thought there should be something pleasingly unobtrusive to look at too, and using some GLSL shaders to run the app visuals seemed like a good fit. So that, like the audio, they could be procedurally generated, and there would be no need for any pre-rendered video or audio tracks - everything can be live.

Realtime Audio on Android

iOS users are pretty well catered for in the realtime audio synthesis and effects department, but on Android it seems to be a much more mixed bag, with less choice. I haven't followed the Android ecosystem closely enough to know why it lags behind iOS here, but suspect it's a combination of hardware support and access to fast audio APIs.

However, I know Android 8 brought some important updates for low-latency audio processing, so perhaps there are lots of new audio apps just around the corner. Also, I recently stumbled upon Oboe - which makes realtime audio processing on Android a lot simpler, so that's where I started with this.

Working from the example projects that Oboe provides I was soon generating and processing sounds, and only nearly deafened myself with horribly loud noise once! I think that was part of this issue, but I also recall a fun bug that caused some non-deafening audio glitches whenever the app UI was interacted with. I think it was actually whenever the UI animated - so when scrolling or transitioning between screens there would be a crackly stream of noise over the normal output.

That delightful bug was down to me reading out of bounds from a buffer and (it seems) it ended up sampling from a location in memory that changed whenever UI elements were animated... And the cause? An integer overflow (wrap-around) when generating an index into the buffer 🤦.

Prior to this it had been a few years since I'd done much work in c++, but by the time I had some simple synthesis, processing, and sequencing all working correctly, it felt a lot more comfortable again.

Simple Visuals

As well as being my first audio app on Android, it's also the first time I've put shaders to work there. And that's thanks, in part, to the excellent Shader Editor project by Markus Fisch, which I used as a guide and basis for getting a working GL shader view that could be easily updated and controlled.

After that was working I just needed to fiddle about and make some simple shaders. That's pretty much my approach to exploring new visual or audio processes; mess about with code until the pretty things come out 🤷. Well, maybe I do usually have a bit more of a plan or an idea for what I want to see or hear, but there certainly is a lot of experimentation in the process.

The (Quieter) Future

As long as my schedule allows it I'm going to continue working on updates for Calm to add more presets and capabilities, but one of the aims when I started this was to investigate the current Android audio situation to enable (my own) development of more audio apps on the platform.

So, ultimately, that's what's next; Small, focussed, fun audio toys. Synths, arpeggiators, drum / percussion machines, effects, ...

Making Calm was the initial step towards those goals, and I'll be building on all the work I've done here for the future of Quieter audio apps.