A Tauri 2 + Rust + wgpu example that treats live audio as a structured native input source rather than a single volume value.
microphone / line input
↓ CPAL native host
interleaved device samples
↓ mono conversion
Hann window + RustFFT
↓
256 logarithmic spectrum bins
512 waveform samples
RMS / peak / four bands / centroid / transient
↓ queue.write_buffer
WGSL visualization
↓
Metal / Vulkan / DX12 surface
npm install
npm run dev:metal # macOS
Or allow wgpu to choose the backend:
npm run dev
Starting audio may trigger the operating system microphone permission prompt.
The Rust audio layer publishes:
The CPAL callback performs only channel mixing and a bounded try_send. FFT work runs away from the real-time callback so GPU and analysis work cannot block the native audio thread.
NSMicrophoneUsageDescription is included.Ubuntu/Debian:
sudo apt install libasound2-dev
This example deliberately performs FFT analysis in Rust and sends compact results to the GPU. That keeps the audio callback simple, provides readable signal-analysis code, and allows the same spectrum buffer to control any later wgpu system. A future example can compare this baseline with a compute-shader FFT.