In my series of blog posts on using code generation for audio manipulation on the Arduino platform, we've been building up the syntax for a little Smalltalk-like language, as well as a compiler to generate C++ on top of an object-oriented message dispatching virtual machine architecture. Recent posts have discussed the syntax of the language, and now I want to spend some time talking about the virtual machine that is used to actually execute the compiled code. A nice thing about the approach we've been using is that you can create your own custom virtual machine with only the capabilities that you need, which can be helpful on environments with limited resources such as Arduino. However, this is additional work for the user, who ultimately just wants to get to making some music and not mess around too much with virtual machines.
In order to facilitate ease of use, I have started to bundle together the most useful effects into a more full-featured collection that I'm calling the Ultraviolet virtual machine. For the first time, I have code generated wrappers for the entire Audio library instead of just the pieces that I'm using in each example sketch. This collection of pre-generated C++ code is available on github as the UltravioletArduino library. The source to generate the Arduino library, along with some rough notes on the philosophy of its design, is available on github in the more general Ultraviolet repository. It's early days for this library, but I hope that eventually it will have everything you need for programming audio effects on Arduino without the need to write C++ code at all.
While the virtual machine implementation currently concentrates on providing an interface to the Audio library for Arduino, I am also going to start adding support for other Arduino functionality that you might want to use in an audio effect, such as reading the values of analog knobs. Additionally, I will be adding support for the sort of basic computations you would use while writing an effect, such as an implementation of integer math, and effects you would use to do computations, such as holding mutable state. The short-term, actionable goal, is to replace Steve's custom tremolo effects, currently written in C++, with one written in Bell and compiled down to the Ultraviolet virtial machine.