Skip to content

JamieBeverley/wasm-audio-worklet

Repository files navigation

wasm-audio-worklet

Template Repo for creating for creating Web Audio Worklets that run DSP from WASM generated by Rust.

Rust -> WASM -> Audio Worklet -> threaded realtime audio in the browser

Note: this was previously a Proof-of-Concept repo more for demo purposes - it is starting to grow into more of an actual library/collection of Audio Worklet tools.

As those tools grow in complexity, the utility of this repo as a demo/learning resource as originally intended may decline.

A snapshot of a somewhat minimal-working example with more code comments is available at the mvp git tag.

Directory Map

  • ./:
    • the root of the project is an npm module that is intended to be a portable rust/wasm AudioWorkletNode
    • Intended to be a simple npm install for other JS projects to import this module so the wasm + worklet are bundled too
    • presently it exposes AudioWorkletNode[s]
    • public/<...>.wasm and public/worklet.js get bundled as well as they must be loaded statically
    • The AudioNode gets reference to their paths via URL(...).href
  • ./crates - a cargo workspace of several crates that we compile to wasm to perform DSP. These use share a ./crates/common crate for shared utilities
    • built via cargo build --target wasm32-unknown-unknown (notably not with wasm-pack)
  • ./demo
    • a small vite vanilla-ts page for testing things

Things Tried + Resources

About

Template/PoC repo for Rust -> WASM -> AudioWorklet

Resources

License

Stars

Watchers

Forks

Packages

No packages published