Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Add an option to disable audio ducking during review

Open truthyblue opened this issue 4 months ago • 4 comments

Feature request

Please add a user-selectable option in the reviewing/audio preferences to disable background-audio ducking while card audio is playing.

Motivation

Some users review cards while listening to music. AnkiDroid currently requests transient audio focus that lowers the volume of other media during card audio playback. This is helpful for many users, but others would prefer card audio and background music to play at their independently chosen volumes.

At the moment, the only practical workaround is to disable card autoplay entirely. That does not solve the same use case, because manually playing card audio can still lower the background music.

Proposed behavior

Add a preference such as:

Duck background audio during card playback

  • Enabled by default: preserve the current behavior.
  • Disabled: do not request AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK; allow card audio to mix with background media at its existing volume where Android supports it.
  • Apply the preference consistently to normal [sound:...] audio, TTS, and HTML <audio> / WebView playback where technically possible.
  • If WebView playback cannot follow the preference, please document that limitation in the setting description.
  • Continue releasing any acquired audio focus when playback finishes.

This makes the behavior opt-in per user without changing the current default for anyone.

Related history

  • #5284 requested an enable/disable audio-ducking option, but was closed after going stale without an implementation.
  • #4441 discussed a setting that would avoid requesting audio focus.
  • #3529 proposed selectable background-music behavior and was accepted, but later closed as stale.
  • #241 originally introduced background-audio ducking.
  • #9288 restored ducking after it stopped working.
  • #5818 fixed releasing audio focus after playback.

AnkiMobile also exposes ducking as a user preference, so a similar choice in AnkiDroid would make this behavior controllable instead of mandatory.

truthyblue avatar Aug 02 '26 12:08 truthyblue

Hello! 👋 Thanks for logging this issue. Please remember we are all volunteers here, so some patience may be required before we can get to the issue. Also remember that the fastest way to get resolution on an issue is to propose a change directly, https://github.com/ankidroid/Anki-Android/wiki/Contributing

welcome[bot] avatar Aug 02 '26 12:08 welcome[bot]

@david-allison we can add a setting to turn off audio ducking. if you switch it off, card audio just mixes with your background music instead of lowering the volume. only thing is it won't affect TTS or webview audio since they handle focus on their own.

Please tell me if this approach is ok. I'd appreciate working on this issue.

Sanjeev-Narang avatar Aug 02 '26 14:08 Sanjeev-Narang

Before we work on this, can you elaborate on AnkiMobile, as this will influence our design.

AnkiMobile also exposes ducking as a user preference, so a similar choice in AnkiDroid would make this behavior controllable instead of mandatory.

david-allison avatar Aug 02 '26 16:08 david-allison

On second thought, let's move this to the forums. It's not accepted as an issue yet, and it's been discussed a few times in the past.

If it's in AnkiMobile, then we can move it back under https://github.com/ankidroid/Anki-Android/labels/Anki%20Ecosystem%20Compatibility with a full spec

david-allison avatar Aug 02 '26 20:08 david-allison