Skip to content

The Sound mixer loses the start of an app's sounds and plays the app at full volume while its tap is rebuilt #897

Done

Description

@M4n0x

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

  1. In the Sound details, turn an app down to about 20% and allow System Audio Recording.
  2. Make the app play a short sound, such as a notification, or pause and resume what it plays.
  3. 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

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.

  • AudioDeviceStart while 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 coreaudiod then holds PreventUserIdleSystemSleep (com.apple.audio.<device>.context.preventuseridlesleep). A device left running keeps the Mac awake.
  • AudioDeviceStop then AudioDeviceStart while 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.
  • AudioDeviceStart on a device that already runs leaves it idle until the app's next start, so what plays meanwhile stays muted.
  • Setting kAudioTapPropertyDescription on a running tap changes its processes in place, with no gap over 25 ms in the device's cycles.
  • .muted and .mutedWhenTapped behave the same in all of the above.

Diagnosis

  • Sources/StableBar/DataSources/AppAudioTap.swift: the tap uses muteBehavior = .muted, which mutes the app's processes whether or not the device runs, and setPlaying starts and stops the device.
  • Sources/StableBar/DataSources/MixerState.swift, tapEffects(): .setPlaying(id, true) follows kAudioProcessPropertyIsRunningOutput, which AudioMixer hears on the main queue (AudioObjectAddPropertyListenerBlock(…, .main, …) in Sources/StableBar/DataSources/AudioMixer.swift) and performs through a task and BlockingWork.
  • tapEffects() emits .stopTap(id) before .startTap(id, tap) when an app's processes or output change, and AppAudioTap.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 tapautostart starts 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

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    bug
    on Nov 22, 2026
  2. stablebar-releases commented on Nov 29, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.20.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions