Repository navigation
Done
Description
What happens
For an app with its own volume, mute or output in the Sound details' Apps:
- The start of each sound is lost. The app's tap mutes it from the moment the tap exists, but StableBar starts the tap's output only after it hears that the app plays: on the main thread, then through a task. A short sound, such as a notification, can be lost entirely, and the delay grows while the main thread is busy.
- The app plays at full volume while its tap is rebuilt. When the processes that play the app's sound change, such as a helper process starting or quitting, StableBar destroys the app's tap before it builds the new one. In between, the app plays at its full volume on the default output, then stops while the new output starts. Changing the app's output does the same.
Steps to reproduce
- In the Sound details, turn an app down to about 20% and allow System Audio Recording.
- Make the app play a short sound, such as a notification, or pause and resume what it plays.
- Make the app start or quit a helper process that plays sound, or change its output.
Found by reading the code. The CoreAudio behavior below was checked with a standalone test, not yet timed in the running bar.
Expected
The app's sound starts at its volume from its first sample, and stays at its volume, never at full volume, while its processes or its output change.
Environment
- StableBar 0.19.0 betas since
v0.19.0-beta.20261120134742(feat: control each app's sound, the input device and music from the Sound widget #877), andmainat 1cb5b24. - Any macOS with the mixer (14.2 and later); tested on macOS 27.2.1.
Evidence
A standalone test on macOS 27.2.1: a private process tap on a test process playing a tone, read by a private aggregate device with tapautostart.
AudioDeviceStartwhile the app is quiet returns at once. The device stays idle, and nothing holds off sleep, until the app starts its output; CoreAudio then starts the device with it, and the first cycles carry the app's sound.- Once started, the device keeps running after the app stops, and
coreaudiodthen holdsPreventUserIdleSystemSleep(com.apple.audio.<device>.context.preventuseridlesleep). A device left running keeps the Mac awake. AudioDeviceStopthenAudioDeviceStartwhile the app is quiet makes the device wait for the app's next sound again. While the app plays, it restarts the device after a gap of about 45 ms.AudioDeviceStarton a device that already runs leaves it idle until the app's next start, so what plays meanwhile stays muted.- Setting
kAudioTapPropertyDescriptionon a running tap changes its processes in place, with no gap over 25 ms in the device's cycles. .mutedand.mutedWhenTappedbehave the same in all of the above.
Diagnosis
Sources/StableBar/DataSources/AppAudioTap.swift: the tap usesmuteBehavior = .muted, which mutes the app's processes whether or not the device runs, andsetPlayingstarts and stops the device.Sources/StableBar/DataSources/MixerState.swift,tapEffects():.setPlaying(id, true)followskAudioProcessPropertyIsRunningOutput, whichAudioMixerhears on the main queue (AudioObjectAddPropertyListenerBlock(…, .main, …)inSources/StableBar/DataSources/AudioMixer.swift) and performs through a task andBlockingWork.tapEffects()emits.stopTap(id)before.startTap(id, tap)when an app's processes or output change, andAppAudioTap.stop()destroys the tap, which unmutes the app.
Proposed fix:
- Start each tap's device as soon as the tap exists, and stop and start it again whenever the app goes quiet, so
tapautostartstarts it with the app's next sound and it stays idle in between, letting the output and the Mac sleep. Hearing that the app plays only restarts a device that doesn't run. - Change a running tap's processes in place through
kAudioTapPropertyDescription, and build the tap for a new output before stopping the old one. - Keep
.muted, so a race costs a moment of silence, never a moment at full volume.
Related
- Control the Mac's sound from the Sound widget: each app's volume and output, the input device and music #876 and feat: control each app's sound, the input device and music from the Sound widget #877 added the mixer, and The Sound widget lists StableBar's own mixer devices as outputs #885 and fix: leave StableBar's own mixer devices out of the Sound widget's device lists #886 left its devices out of the device lists. None covers when its taps start, stop or change.
Triaged by Claude Code (Claude Opus 5.5).
Activity
fix: keep a mixer tap running when an earlier process update fails
fix: let a mixer tap's device wait again after a sound StableBar missed
fix: keep a mixer tap stopped between sounds where macOS doesn't make…
fix: play an app's first sound at its mixer volume
docs: record why the mixer's taps stay in StableBar's process
fix: keep a mixer tap running when an earlier process update fails
fix: let a mixer tap's device wait again after a sound StableBar missed
fix: keep a mixer tap stopped between sounds where macOS doesn't make…
fix: play an app's first sound at its mixer volume
docs: record why the mixer's taps stay in StableBar's process
fix: keep a mixer tap running when an earlier process update fails
fix: let a mixer tap's device wait again after a sound StableBar missed
fix: keep a mixer tap stopped between sounds where macOS doesn't make…
chore(release): 0.20.0 [skip ci]
stablebar-releases commentedon Nov 29, 2026
🎉 This issue has been resolved in version 0.20.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀