Skip to content

JamieBeverley/wasm-audio-worklet

Repository files navigation

wasm-audio-worklet

Proof-of-concept (to-be-made-template) for creating Web Audio Worklets that run DSP from WASM generated by Rust. Rust -> WASM -> Audio Worklet -> threaded realtime audio in the browser

(with hopes that there may also be some performance gain in using WASM instead of JS AudioWorklets but we'll see?)

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 a new AudioWorkletNode
    • public/rust_wasm.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
  • ./rust-wasm - the rust crate we compile to wasm to perform DSP.
    • 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