
Driftwave
Audio waveform visualization that's fast, accurate, and portable
Driftwave provides:
- π Waveform visualization ready for GPU rendering
- π WebAssembly support for browser deployment
- π Audio playback with multiple backend support
- π§ Language bindings for Python, Javascript, Java, and more
Why Driftwave?
Most waveform tools compromise on either precision or portability. Driftwave doesnβt. It delivers research-grade accuracy for engineers, scientists, and developers in a form that can be consumed in any environment.
Project goals
- π― Exact Precision: Every sample mapped to the right pixel, enabling reliable measurement and annotation.
- π High Speed: GPU acceleration and SIMD keep panning, zooming, and scrubbing fluidβeven with hours of high-resolution audio.
- Cross-Platform by Design:
- π WebAssembly bundles for browsers, for web audio
- π₯οΈ Native runtimes on macOS, Windows, and Linux
- π Default native playback with FMOD
- π Built for Analysis: Not just pretty graphicsβan engine ready for phonetics research, bioacoustics, and industrial signal analysis with sample-level precision.
Technology
- Rust core for safety and speed
- WebGPU renderer for portable GPU acceleration
- SIMD-optimized peak/RMS detection for efficient audio crunching
- Configurable DSP so you can focus on the signal, not the noise
- Phase-locked loop motion stabilization (optional)
- Advanced latency estimation in desktop versions
- Javascript bindings compatible with any UI framework
Quick Links
Getting Started
Coming soon...
This guide will cover:
- Installation and setup
- Basic usage examples
- Audio playback
- Waveform visualization
- Language bindings
Check back soon for the complete guide!
Development Guide
Building the library
Prerequisites
All platforms:
For web support:
rustup target add wasm32-unknown-unknown
cargo install wasm-pack
Build native
# Build all workspace members (core, fmod, tools)
cargo build
# Build specific crates
cargo build -p driftwave-core # Core traits and types
cargo build -p driftwave-fmod # FMOD audio implementation
# Build release mode
cargo build --release
Build web
# Build WASM module into js package
cd src-web
wasm-pack build --release --target web --out-dir ../js/wasm
# Build NPM package
cd ../js
npm install
npm run build
# Create publishable package
npm pack # Creates driftwave-x.x.x.tgz
Project Structure
src-core/
- Core traits and shared types (Player trait, etc.)src-fmod/
- FMOD audio implementation for desktopsrc-web/
- Web bindings (WASM, not in workspace)js/
- JavaScript/TypeScript wrapper for NPMtools/
- Build utilities and code generationexamples/
- Standalone example applications
Running Examples
Examples are standalone projects with their own dependencies. See the README in each example directory for specific instructions.
Develop
Enable git hooks for automatic code formatting:
git config core.hooksPath .githooks
Regenerate FMOD FFI bindings:
cargo run --bin generate_bindings
Waveform Renderer Interface Design
Core philosophy
An audio waveform renderer with playback that's "stupid easy" to consume from any language or environment. This means:
- π WebAssembly support with minimal JavaScript glue
- π Simple C-compatible FFI for native bindings
- πΌοΈ Pull-based viewport rendering that's configurable:
- Any FPS
- Geometric output for GPU-based rendering (WebGPU, OpenGL, etc)
- Rasterized output for CPU-based rendering
- Optional phase-locked loop smoothing
- π Pluggable audio implementations:
- FMOD for native
- Web Audio for web
- Bring-your-own (JUCE, PortAudio, etc)
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββ
β Consumer Layer β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Python β JavaScript β Swift β C++ β Java β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β Bindings Layer β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β C FFI β WASM API β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β src-core (Rust) β
β ββββββββββββββββββββββββββββββββββββββ β
β β Waveform Renderer Core β β
β ββββββββββββββββββββββββββββββββββββββ€ β
β β β’ Peak detection β β
|. | β’ RMS detection β β
β β β’ Audio plugin bridge β β
|. | β’ Phase-locked loop smoothing β β
β β β’ Viewport rendering β β
β ββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββ
Javascript usage
const driftwave = await Driftwave.create();
driftwave.load('audio.mp3');
driftwave.on('ready', () => driftwave.play());