Skip to content

Audio Engine

The core audio engine is written in safe Rust with zero-copy buffer management and lock-free ring buffer communication.

brūhi uses a directed acyclic graph (DAG) for signal routing and real-time mixing:

[Deck A / B] ──→ [Gap Killer & Crossfader] ──→ [Master Mix] ──→ [DSP Chain] ──→ [Encoders / Outputs]
[Microphones] ──→ [Mic DSP & HPF Filter] ─────↗
  • Audio Thread: Real-time priority, zero allocations on hot paths, lock-free ring buffers.
  • Playout & Preload Thread: Evaluates upcoming queue items, handles idle deck auto preloading based on playback state.
  • Control Thread: Interfaces with Tauri IPC, UI state, and parameter changes.
  • Network Encoder Thread: Handles Icecast MP3/Opus streaming, SRT/RTP packet fan-out.
  • Opus Encoder with Ogg Support: High-efficiency streaming with native Ogg container encapsulation.
  • Icecast MP3 Optimization: Enhanced connection retries, buffer management, and ICY metadata updates.
  • Multi-Format Fan-out: Simultaneous output to MP3, Opus, AAC-LC, WAV, and FLAC without CPU overhead.
  • Crossfade Visualizer: Real-time visual curve monitoring for deck transitions.
  • Gap Killer Logic: Automatically detects track silence at intro/outro using configurable dB threshold settings and duration parameters.
  • Deck Preloading: When the active deck nears completion, the idle deck preloads the next track seamlessly.