Back to Wasm Bindgen

WebAudio

guide/src/examples/web-audio.md

0.2.120936 B
Original Source

WebAudio

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.

toml
{{#include ../../../examples/webaudio/Cargo.toml}}

src/lib.rs

The Rust code implements the FM oscillator.

rust
{{#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.

js
{{#include ../../../examples/webaudio/index.js}}