I am going to use Sorollet.js in this experiment, just as I did with MACCHINA I.
I did the initial port for MACCHINA I, but I wasn't really happy with the result. It was cumbersome, had much boiler plate and it definitely wasn't elegant! And that's why the github repository is still empty right now ;-)
I started rewriting it yesterday after I posted yesterday's WIP post. I always start with the key block: the voice, which is the smallest block in the synth--a voice emits sound.
Once I got the voice sort of working I moved to rewriting the ADSR class. An ADSR envelope helps you define property changes over time. Wikipedia explains it better than me, so I'll simply add how I use ADSR envelopes: I use it for modifying the pitch and the volume. So that way you can build "complex" sounds that sort of trick the user into thinking this is a more advanced machine. For example one of my favourite tricks is starting with a very high note and then rapidly decreasing its pitch, and at the same time the volume also goes from high to low. This generates a bassdrum-like sound!
Unfortunately I don't have an example yet as I haven't totally finished with the ADSR class here. There were some errors in the way the transitions between states happened and I fixed these, and I also wanted to ensure the method names made sense. That always requires a lot of careful thinking and reconsidering.
Hopefully I'll have some online demo soon, so you can play with the synth online. It will be fun!