I've done a fair bit of tinkering with the amazing AudioKit framework and I've also done a fair bit of tinkering with node based user interfaces. Ever since AudioKit introduced nodes, I've been planning to marry the two together and build Nodality for AudioKit. I'm pleased to say after only a few days of work, it's working, stable, open-sourced and available here.
I actually open-sourced the node based user interface component back in September 2015 (see: A Swift Node Based User Interface Component for iOS), so I dusted it off and got cracking.
AudioKit's new API makes building networks of nodes super simple. Let's imagine some crazy system with a pink noise source passing though a reverb which is mixed with a square wave oscillator. The network could look a little like this:
The code required to build this network is simply:
let pinkNoise = AKPinkNoise() let reverb = AKReverb(pinkNoise) let squareWave = AKSquareWaveOscillator() let dryWetMixer = AKDryWetMixer(reverb, squareWave, balance: 0.5) pinkNoise.start() squareWave.start() AudioKit.output = dryWetMixer AudioKit.start()
Take a look at the video above to see the interaction design:
- To create a new node, do a long press on the background. A modal form sheet will pop up allowing the selection of the type of the new node.
- To create a relationship between two nodes, long press on the source node. The screen background will turn to a light grey color and a further tap on the row of a target node will create the relationship. Illegal targets (e.g. attempting to create a relationship between a numeric node and an AudioKit node input) are greyed out.
A big shout out to Aurelius and Matthew who provided technical and moral support while I wrote this and to the rest of the AudioKit team for creating such an awesome framework. I know nothing about audio at all, and AudioKit has enabled me to write a node based synthesiser in a few days!