1. 60

I wrote a blog post going over the technical details of both FM synthesis as well as the process of building the synth by compiling Rust to WebAssembly and running it performantly in the browser via Web Audio: https://cprimozic.net/blog/fm-synth-rust-wasm-simd/

Full source code: https://github.com/ameobea/web-synth

  1. 11

    I’ve been working with audio programming in the browser with Rust + Wasm for a while, and I’m convinced it’s an extremely powerful combo for doing this kind of work. The performance is amazing, and the flexibility it provides is really high since users can run this high-performance, latency-sensitive code on their local machines without having to worry about security issues or installation/setup; just visit the URL and it’s ready to go.

    There’s a lot of other really cool audio programming tech that supports compiling to Wasm, namely the Soul programming language and Faust programming langauge. I’ve implemented an embedded editor for my web synth tool where code written in either of these languages can be entered, compiled to Wasm, and then dynamically loaded into the audio graph with an auto-generated UI instantly. As you can imagine this is a very useful ability to have with experimenting with effects or synthesis techniques where a quick development feedback loop is useful.

    If you’re doing or interested in doing audio programming in the browser with Wasm and/or Rust, I’d love to chat about it! And if you have any feedback on the synthesizer or questions, I’d love to hear them as well.

    1. 3

      Very cool! I had actually wanted to experiment with Rust to do a simple 4-op FM synths on an ARM microcontroller.

      For anyone not familiar with FM synth sounds… you’ve definitely heard it if you listened any pop music from the 80s - either from the Synclavier or the famous Yamaha DX7. Yamaha’s cost-reduced 4-op FM synths (like the DX100) were also a staple of 90s house music.

      1. 4

        Or played on a Sega Genesis / Mega Drive.

        1. 3

          Can we get an in-browser version of the OP-1? ;)

          1. 5

            You just want the cow, be honest with yourself. :-)

            But more seriously, I got a similar idea about making a sampler in the browser à la MPC or SP404. Not sur if the workflow may fit a no-pad no touch device. Or going back to a tracker like Renoise or Sunvox that fit the computer interface.

          2. 2

            You should def. go for it! It would be really cool to get something running on a microcontroller like that, and Rust seems like the perfect language to make that happen.

          3. 2

            I am on Firefox on iOS and the website tells me my browser isn’t supported, even though OP says it should work on mobile Firefox.

            1. 2

              Firefox on iOS is not Firefox at all. It’s just a wrapped Safari in-app web view called Firefox only because it supports FF Sync.

            2. 2

              Nice. I’ve been playing with implementing fm synthesis in fpga because why not