Header Ads

Web Assembly, Music Synthesis, and the Beauty of Math

The electronics hobby has changed a lot since the advent of the microprocessor. Before that — and with the lack of large-scale integrated circuits — projects in magazines tended to be either super simple or ultra complex. However, one popular type of project dealt with music synthesis. Fairly simple circuits could combine to make a complex synthesizer so it was sort of the best of both worlds. Nowadays, you are more likely to tackle a music synthesizer in software like [Tim] did when he created Abelton in Web Assembly and C++. Along the way, he learned a lot about the relationship between math and music.

[Tim] covers what he learned about the Nyquist theorem and how to keep synthesis data flowing in real time with buffers. However, there are some problems trying to do all this in a cross-browser context. The AudioWorklet class appears to have widespread support, though, and [Tim] managed to get that working.

If you ever wondered if you could use a formula to compute MIDI tones to frequency instead of a table, the answer is yes. Using emscripten allows easy compilation, but integrating into rollup.js — a JavaScript framework — was a bit of work, and you’ll find the process documented in the post.

If you want to know more about WebAssembly, check out our earlier post. We’ve seen emscripten do interesting things on the Web before, too.


No comments