Lightweight audio keepalive to prevent aggressive USB DAC auto-muting and fade-in delay on Linux.
Files
README.md

dac-keepalive #

A lightweight background audio keepalive solution for USB DACs that aggressively auto-mute or enter low-power sleep on digital silence, causing perceptible fade-in delays when playback starts (common in Aegisub, Kdenlive, FL Studio, etc.).

It feeds a continuous, completely inaudible signal (ultrasonic 21.5 kHz, infrasonic 15 Hz, or low-amplitude dither) directly to your chosen DAC sink. Because the waveform is precomputed once in RAM and streamed via libpulse-simple, it consumes ~0.0% CPU and ~5 MB RAM.


Requirements #

  • Linux with PipeWire (or PulseAudio)
  • libpulse / libpulse-simple
  • gcc and make

Build & Install #

git clone https://tangled.org/ufal.my.id/dac-keepalive
cd dac-keepalive
make
make install

This installs:

  • ~/.local/bin/dac-keepalive-daemon (the audio engine)
  • ~/.local/bin/dac-keepalive (the CLI control tool)
  • ~/.config/systemd/user/dac-keepalive.service (the user systemd service)

Quick Start & Setup #

On first run (or anytime via dac-keepalive setup), an interactive numbered menu will prompt you to pick your DAC device and preferred frequency:

dac-keepalive setup

Menu options:

  • 1. device — Lists all connected audio sinks from pactl for easy selection.
  • 2. frequency — Choose between 21khz (ultrasonic), 15hz (infrasonic), or noise (dither).

You can also configure them directly without the menu:

dac-keepalive setup device
dac-keepalive setup frequency

Usage #

Command Description
dac-keepalive Toggle ON / OFF (runs setup on first run)
dac-keepalive on Turn ON (checks that device is plugged in)
dac-keepalive off Turn OFF
dac-keepalive status Show status, device name, and frequency
dac-keepalive setup [device|frequency] Configure target device or frequency
dac-keepalive reset Prompts confirmation and removes config file
dac-keepalive test Run 10-second test in foreground

Configuration File #

Configuration is saved in ~/.config/dac-keepalive/config:

DEVICE=alsa_output.usb-Generic_AB13X_USB_Audio_20210726905926-00.analog-stereo
FREQUENCY=21khz
AMPLITUDE=200