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