View full source code or view the compiled example online
This example creates an FM oscillator using the WebAudio API and web-sys.
Cargo.tomlThe Cargo.toml enables the types needed to use the relevant bits of the WebAudio API.
{{#include ../../../examples/webaudio/Cargo.toml}}
src/lib.rsThe Rust code implements the FM oscillator.
{{#include ../../../examples/webaudio/src/lib.rs}}
index.jsA small bit of JavaScript glues the rust module to input widgets and translates events into calls into wasm code.
{{#include ../../../examples/webaudio/index.js}}