Keyboard shortcuts

Press ← or β†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Logo
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

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 desktop
  • src-web/ - Web bindings (WASM, not in workspace)
  • js/ - JavaScript/TypeScript wrapper for NPM
  • tools/ - Build utilities and code generation
  • examples/ - 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());

WaveSurfer.js

Peaks.js