TV volume auto-leveler. Keeps volume consistent by dynamically adjusting it — turns down explosions, turns up quiet dialogue.
Two components talking over HTTP:
- Listener (Rust, runs on Raspberry Pi / Linux) — captures audio from a USB mic near the TV, analyzes loudness with a real-time dynamic range compressor, sends volume commands to the controller
- Controller (C# .NET 8, runs on Windows 11) — receives HTTP commands and sets Windows system volume via Core Audio API (NAudio)
Requires .NET 8 SDK.
cd controller
dotnet run
# or: dotnet run 8765 (custom port)To allow network access, run once as Administrator:
netsh http add urlacl url=http://+:8765/ user=Everyone
netsh advfirewall firewall add rule name="Audilator" dir=in action=allow protocol=tcp localport=8765To publish a standalone exe:
dotnet publish -c Release -r win-x64 --self-containedRequires Rust toolchain (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh) and ALSA dev headers:
sudo apt install libasound2-dev
cd audilatorv2
cargo build --releaseFirst, calibrate with your mic and TV:
./target/release/audilator --calibrate 30
# Play some dialogue and some loud action scenes for 30 seconds
# It will suggest --target and --dead-zone valuesThen run:
./target/release/audilator --windows-ip 192.168.1.100 --target -25Cross-compile from Mac (optional):
rustup target add aarch64-unknown-linux-gnu
# Requires a linker for ARM Linux (e.g., via cross or zig)
cargo build --release --target aarch64-unknown-linux-gnu--windows-ip Windows controller IP (default: 192.168.1.100)
--port Controller port (default: 8765)
--target Target loudness in dBFS (default: -25.0)
--dead-zone No-adjust zone in dB (default: 4.0)
--hysteresis Hysteresis in dB (default: 2.0)
--attack Attack time in ms (default: 100)
--release Release time in ms (default: 2000)
--max-slew Max volume change dB/sec (default: 30)
--device Audio input device name (substring match)
--list-devices List available audio devices
--calibrate N Listen for N seconds and suggest settings
--sample-rate Audio sample rate (default: 48000)
- USB mic near TV captures audio via ALSA
- RMS computed over 50ms windows, converted to dBFS (logarithmic, matches human hearing)
- Attack/release envelope follower smooths the signal (100ms attack catches explosions, 2s release prevents pumping)
- Gain computer checks if envelope is outside the dead zone around the target
- Hysteresis prevents oscillation at dead zone boundaries
- Silence detector freezes volume during quiet pauses (prevents runaway to max)
- Volume changes are slew-rate limited for smooth transitions (max 30 dB/sec)
- Absolute volume commands sent to Windows controller over HTTP