Here is a conceptual JavaScript implementation (Web Audio API style) that you can adapt.
Its standout MIDI features include:
This allows you to play chords. A low note on Channel 1 generates a bass drone, while a high note on Channel 2 generates a lead line. The interaction between the two mathematical formulas can create interference patterns—beating frequencies that evolve organically. midi to bytebeat patched
output = (t * (t >> 8)) & 0xFF;