Your browser loves you and wants you to be safe
so please click or touch somewhere to hear things./player/EntryPlay/32329/32329
another fm engine thingy, but more fully featured this time around. may put more details here in the comments later, haven't bothered cleaning up the code at all either lol
rendered with bytebeat.js nodejs interpreter, turn down SAMPLE_RATE or FEEDBACK_ITERATIONS if too laggy. greggman's tool doesn't work unfortunately, doesn't like parseInt for whatever reason
Okay, more details since I've got time now:
Everything is stateless! No global/shared state across t's, everything is functional. Not that it's necessarily a requirement for bytebeat, but I figure it's a lot closer to the original spirit of it being a waveform defined as a function of time.
I sort of modeled the FM functions off the YM2612. It allows for any number/arrangement of operators but I stuck with 4OP configurations. I also implemented operator feedback, though I think it's more of an approximation (but it sounds close enough at least?). The instrument parameters were hand-written but closely based off of Streets of Rage (someone already tagged it lol).
Most of the time was spent implementing and fixing the FM functions via trial and error. Ended up actually writing the song part over a few hours after having the idea in my head for weeks, which is why everything past the OUTPUT block is just a hot mess. Most of the song data stuff could definitely be packed better, possibly defined in a more concise way as functions, but as much as I wanted to, it was getting late and I couldn't really be bothered to try to think it through, heheh.
The code is a mess, and I was being a bit minimalist about it, but my goal was to make it easy to define instruments at least, which I think worked out well. The implementation ended up being pretty simple too I think, yay recursion! Just pay no attention to the mess that is the song data.