Add "DAC quiet start" option to silence idle DAC noise at boot#772
Add "DAC quiet start" option to silence idle DAC noise at boot#772Gjuju wants to merge 1 commit into
Conversation
4b67ac5 to
2cfd2cb
Compare
|
I'm not opposed to adding certain workarounds for badly behaving DAC's but is there a particular brand DAC in your system thats got this noise issue at startup? |
2cfd2cb to
f62ee2f
Compare
|
Yeah, that's my main DAC and it's DIY : Love it but it set itself in DSD mode just after usb enumeration an sometimes give some low crackle sounds, sometime give some kind of huge white noise and the problem remains unless it plays PCM. Ready Script / ReadyChime partialy do the job but it remains 20sec of potential oddity before it plays. I found an old thread where it could be a benefit, but I aggree it seems to be really rare case. |
999106a to
c924bdd
Compare
Some DACs with no output mute relay emit a continuous hiss/crackle at startup — typically a USB DAC right after its enumeration — and keep it until the first track plays, because MPD restores state=stop and with close_on_pause=yes never opens the device at boot. Add a Configure > Audio toggle (cfg_system dac_prime, default off) that plays ~1s of silence into the selected output card the moment it initializes, which settles the DAC. The hardware pop at power-on is not affected. It is not USB-specific — an I2S DAC that hisses at power-on benefits the same way, priming is harmless, and it's opt-in. Implemented with a udev rule on the sound-card ADD event (KERNEL==controlC*, the reliable sync point — the control node is created last, once every pcm child is ready), mirroring the existing 10-a2dp-autoconnect.rules pattern and detaching the ~1s aplay via systemd-run --no-block so udev doesn't kill it. The rule fires at enumeration on every boot and on hot-plug, and primes only the currently selected MPD output (cfg_mpd.device). The rule ships as a versioned file disabled (89-moode-dac-prime.rules.disabled); worker.php applyDacPrime() is the authority and enables/disables it by renaming .disabled <-> .rules from the DB setting, at boot and on the job.
c924bdd to
7a3cdde
Compare
Problem
Some DACs without an output mute relay emit a continuous hiss/crackle from
startup — typically a USB DAC right after it enumerates — and keep it until the
first track plays. moOde never feeds the device at boot: MPD restores
state=stopand, withclose_on_pause=yes, never opens the output. So the DACsits making noise until playback starts. (The brief hardware pop at power-on is
separate and unavoidable.)
Solution
A new Configure → Audio → "DAC quiet start" toggle (
cfg_system.dac_prime,default off). When enabled, moOde plays ~1 s of digital silence into the
selected output card the moment it initializes, which settles the DAC. It is not
USB-specific — an I2S DAC that hisses at power-on benefits the same way, and
priming any selected card is harmless (opt-in).
How it works
addevent, matchingKERNEL=="controlC*"— the reliable sync point, since the ALSA control node is created last, after
every pcm child (cf.
/lib/udev/rules.d/78-sound-card.rules).systemd-run --no-block /usr/local/bin/moode-dac-prime %k, whichdetaches the ~1 s
aplayfrom the udev event (udev kills long-runningRUNchildren). Same delegation pattern already used by
10-a2dp-autoconnect.rules.(
cfg_mpd.device), openingplughw:<card>,0directly since the DSP chain isn'tup yet at enumeration time.
addevent, it works at boot and on hot-plug, no polling.Enable / disable
The rule ships as a versioned file, disabled
(
89-moode-dac-prime.rules.disabled).worker.php'sapplyDacPrime()is thesingle authority: it enables/disables the rule by renaming
.disabled ⇄ .rulesaccording to
dac_prime, both at worker startup and on the toggle's job. Sincethe rule is a persistent file, once enabled it triggers at enumeration on later
boots without waiting for the worker.
Files
var/local/www/db/moode-sqlite3.db.sql— newdac_primeparam (default off)www/snd-config.php,www/templates/snd-config.html— the toggle (mirrors theexisting Autoplay control)
www/daemon/worker.php—applyDacPrime(), boot-time application, and thedac_primejobetc/udev/rules.d/89-moode-dac-prime.rules.disabled— the udev rule, shippeddisabled
usr/local/bin/moode-dac-prime— the prime script (packaged executable, likea2dp-autoconnect)Notes
residual idle noise that follows it.
the silence taking effect, due to the
systemd-runtransient-unit spin-up.