Distractions! While I did get to learn a bit of Python in February as planned, the one language per month project got nevertheless derailed this month. From the start of the project I was dubious as to how long I can keep it up, but I did not think it would happen so early in the year. I will continue onwards with the next language and shall post the piece on Python soon. But fortunately I had a good reason for not keeping up.
I have a 1970’s combo organ, a Yamaha YC20. The instrument has been with me for a while now and I’ve become quite attached to it. Some years ago, the previously dependable device developed some serious issues and I was somewhat startled if I would lose the organ altogether. While researching how to repair the organ, I developed an understanding of how the organ works internally. During the same time I had also became curious about a specialized functional programming language for DSP called Faust. My technologist geek side got the better of me and I dived into a project to recreate the organ digitally. This work became the Foo YC20.
The project spawned quite a few results back in 2010: a standalone playable instrument, a cross platform plugin for professional use (Linux, Windows and OS X) and a publication at the fantasically geeky Linux Audio Conference. My code has also served as a benchmark for the Faust project and has helped the project developers improve their compiler over the years.
Fast forward to a few weeks back when Stéphane Letz (of Jack 2 and Faust fame) sent me an email with an intriguing HTML file. This file was a self contained HTML + JavaScript realization of my organ. The UI was auto generated by the Faust toolchain and made little sense for this complex instrument but the processing was nevertheless the real deal.
Faust processing code is compiled into JavaScript by a two stage process: the Faust compiler produces intermediary C++ code which is compiled with emscripten into asm.js compatible JavaScript. You can read more about this on the Faust blog.
So I had a working organ in my browser with a lousy UI. I could not leave it at that now could I?
At the core of my excitement of this project was the classic promise of the web: web software will work anywhere. The original Foo YC20 is pretty easy to run and use in a an audio production environment, but it’s really difficult for non audio geeks to try it. Now basically anyone can run the instrument. But be warned:
In case you’re interested in what the original auto generated UI looks like, you can access it here.
The reason this relatively simple synthesizer uses so much CPU power is that it simulates the organ in its entirety. Typical synthesizers work by producing sound as the user plays notes. Divide down combo organs, like the YC20, are very different. They are actually matrix mixers. This particular design contains 12 oscillators and 7 banks of dividers resulting in 96 tone sources which are filtered and mixed together depending on the configuration of various switches and what keys are pressed down. To simulate this accurately means running all these processes all the time and this takes processing power. The upside to this is that your interaction with the organ has no effect on the CPU power required, i.e. pressing down all keys at once will not use a single bit of extra CPU.
Have fun and let me know what you think!
Update May 21st 2015 The web version has been updated and now features both keyboard and MIDI input. Also, the code repository has been moved over to GitHub.