Repository navigation
Duck the Sendspin stream while Alexa holds audio focus - #106
Merged
Merged
Conversation
Owner
|
Hi! Thanks for the PR. I just saw this, so I'll try to take a look at it before the weekend. |
Alexa takes audio focus as GAIN_TRANSIENT_MAY_DUCK while she listens and answers, but Android 5.1 doesn't duck anything itself, and the player holds no focus, so the music carried on at full level over her. alexa.FocusWatcher follows logcat -s MediaFocusControl and keeps the set of clients holding focus, since her requests overlap: one question moved focus through 3 clients over 10 seconds. A may-duck holder takes the stream to 20%, a transient or exclusive one to 10%, the same levels sendspinlite uses on an Echo Show. A permanent gain doesn't duck. Each holder expires after 15 minutes, and the set is cleared whenever logcat exits, so it fails toward full level. Chime.Duck sets a gain the stream applies to its own samples after placement, ramping down in 40 ms and back up in 240 ms, so timing and sync are untouched. At full gain the samples aren't touched at all. The two watchers now share one logcat loop, and its children are started with Pdeathsig: a restart used to leave each watcher's logcat running under init. An expired hold says so in the log, because nothing else shows a duck: it is a gain on the samples, so dumpsys and the volume sensors read unchanged. Verified on a Dot by ear across a "what time is it" with overlapping holders. docs/audio.md has the log format and the numbers.
bboe
force-pushed
the
alexa-focus-ducking
branch
from
October 9, 2026 01:09
8352503 to
aee302d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alexa takes audio focus as GAIN_TRANSIENT_MAY_DUCK while she listens and answers, but Android 5.1 doesn't duck anything itself, and the player holds no focus, so the music carried on at full level over her.
alexa.FocusWatcher follows logcat -s MediaFocusControl and keeps the set of clients holding focus, since her requests overlap: one question moved focus through 3 clients over 10 seconds. A may-duck holder takes the stream to 20%, a transient or exclusive one to 10%, the same levels sendspinlite uses on an Echo Show. A permanent gain doesn't duck. Each holder expires after 15 minutes, and the set is cleared whenever logcat exits, so it fails towards full level.
Chime.Duck sets a gain the stream applies to its own samples after placement, ramping down in 40 ms and back up in 240 ms, so timing and sync are untouched. At full gain the samples aren't touched at all.
The two watchers now share one logcat loop, and its children are started with Pdeathsig: a restart used to leave each watcher's logcat running under init.
Verified on a Dot by ear across a "what time is it" with overlapping holders. docs/audio.md has the log format and the numbers.
Happy to adapt, etc, or if you don't want to integrate it I'll just keep using my fork 😄