This is a bit of an odd one!
Web Assembly, or wasm, is a low-level assembly-like language designed to run fast on modern browsers. It is also the output format used by Emscripten, the tool we use to compile our patches into Javascript. Lots of different languages can be compiled into wasm, and run in a wasm interpreter (though browsers, for efficiency, use JIT compilers instead).
Just for fun I thought I’d see if it is possible to run a wasm interpreter on the OWL. Turns out you can!
I used the wasm3 WebAssembly interpreter.
This patch runs one of their examples, a Fibonacci sequence algorithm. It is utterly pointless, but proves it can be done
It would be quite possible to define a simple api, so that audio data and parameters can be passed to and from the wasm ‘patch’, which itself could be dynamically loaded from a resource or SysEx messages.
My thinking behind this was that it would be nice to find a scriptable solution, with an interpreter running on the OWL, to open up some new use cases such as live coding. Wasm is definitely not a script language itself, but other languages that compile to wasm are scriptable, including for example AssemblyScript. So what wasm provides is an efficient, source-language agnostic interpreter, which is perhaps even better than something like MicroPython which is tied to a specific language. On the other hand, if the source still has to be compiled to wasm, then why not just compile it to native code!
My version of the code is also on GitHub.
A crazy consequence of compiling the WASM patch online is that it also runs in the browser. So the wasm interpreter, written in C, is converted to wasm, and runs a wasm Fibonacci patch inside the wasm JIT compiler of the browser… Argh!