Skip to content

Add Reduce Loud Sounds audio option - #2111

Open
new-usemame wants to merge 12 commits into
damontecres:mainfrom
new-usemame:reduce-loud-sounds
Open

new-usemame wants to merge 12 commits into
damontecres:mainfrom
new-usemame:reduce-loud-sounds

Conversation

@new-usemame

Copy link
Copy Markdown

Description

Adds "Reduce Loud Sounds" in the Video Player Audio menu and in Settings > Playback. Off by default.

When it's on, it evens out audio within a title (loud effects come down, quiet dialogue comes up) and between titles: the leveler resets when a new item starts, so a loud episode after a quiet movie doesn't jump. In my test that jump was 1.4 dB with it on vs 5.2 dB off.

My goal was to match Apple's Reduce Loud Sounds which seems to also bring up quiet sounds to be heard. I find this especially useful at night, too. Prefer it to be called 'Reduce Loud Sounds' instead of 'Night Mode' because 1. it's familiar, 2. it's the generic primary pain point.

It only works on decoded PCM in ExoPlayer, so with it on, offload, tunneling and passthrough are turned off for that player. Passthrough can't be processed without decoding it, and leaving offload and tunneling out kept this first version simpler. Turning it on mid-video either switches the processor in place (if the audio is already PCM) or rebuilds the player at the same position and tracks. With it off, the output is bit-exact. MPV and external players are untouched, and in that case the switch shows "Requires ExoPlayer".

The processing is three plain Kotlin files in playback/leveling/core (loudness measurement, leveler/compressor, limiter), with no native code or new dependencies. A lot of the diff is tests.

Related issues

#1845

Testing

  • 48 new unit tests: the processor (formats, flush/end of stream, bit-exact when off), the Media3 sink/offload/tunneling decisions, live toggling, the player rebuild keeping position and tracks, MPV exclusion, and the settings/menu. All 1,434 tests pass across default/appstore/firetv, and ktlint and the pre-commit checks pass.
  • Android TV emulator (API 30): played stereo and EAC3 5.1 episodes, toggled it on and off mid-episode, and checked the leveler resets on the next episode.
  • CPU cost is about 1.2% of one core for stereo and 1.6% for 5.1, measured on x86. I haven't measured an ARM device yet.

Screenshots

Settings > Playback:
settings-playback

Audio menu during playback:
player-audio-menu

With MPV / Prefer MPV selected:
settings-mpv-requirement

AI or LLM usage

I have professional experience with LLM coding workflows, and used AI assistance (Claude and GPT), including on the processor in playback/leveling/core and the ExoPlayer integration. I've reviewed it all, and it was tested as described above.

new-usemame and others added 12 commits October 19, 2026 21:30
With the setting off the processor still ran the leveler, so Off cost as much CPU as
on. Off now copies the input straight through and leaves the core idle. Turning it on
mid-stream starts a fresh core and fades it in; turning it off fades it out, drains
its delay, then copies again. A seek right after turning it on resets instead of
keeping an estimate from before the core went idle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PidZAomEJnEqTEMxAeYnmC
# Conflicts:
#	app/src/main/java/com/github/damontecres/wholphin/services/PlayerFactory.kt
#	app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackDialog.kt
#	app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackViewModel.kt
#	app/src/main/java/com/github/damontecres/wholphin/ui/playback/overlay/PlaybackControls.kt
#	app/src/main/res/values/strings.xml
@new-usemame

Copy link
Copy Markdown
Author

I've been using this for a few weeks now and would love to get it merged so I don't have to keep both a debug and a prod Wholphin on my machine 🙃

@damontecres

damontecres commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

I've been using this for a few weeks now and would love to get it merged so I don't have to keep both a debug and a prod Wholphin on my machine 🙃

This PR has large changes to several critical parts of the codebase and it's also AI generated, so it will be a while before I find time to review. Plus, I will have to devote a significant amount of time to review. So please don't expect this to be considered for merging anytime soon.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants