Skip to content

feat(player): add volume boost with automatic real-time gain - #13762

Open
dev-stupid-codes wants to merge 1 commit into
TeamNewPipe:devfrom
dev-stupid-codes:volume-boost
Open

feat(player): add volume boost with automatic real-time gain#13762
dev-stupid-codes wants to merge 1 commit into
TeamNewPipe:devfrom
dev-stupid-codes:volume-boost

Conversation

@dev-stupid-codes

@dev-stupid-codes dev-stupid-codes commented Aug 12, 2026

Copy link
Copy Markdown

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

Some streams are mastered so quietly that they are hard to hear even at the maximum
system volume. This adds a volume boost which amplifies the decoded PCM samples before
they reach the audio track, either with a gain the user picks or with one the player
derives from the stream in real time.

  • A new speaker button in the player control bar opens a dialog with a 100%–300%
    slider
    and an "Adjust automatically" switch (off by default). The popup player
    has no activity to host a dialog, so it gets a menu of gains instead.
  • VolumeBoostAudioProcessor amplifies 16 bit and float PCM, clipping whatever exceeds
    the range of the encoding (the same trade-off VLC makes for its own volume boost).
  • In automatic mode it measures the loudness (RMS) and the peak of every buffer, aims
    for roughly -16 dBFS, caps the gain so the peak stays below full scale, and smooths
    the gain with a fast attack (50 ms) and a slow release (2 s), so a sudden loud passage
    does not clip and a quiet one does not pump. It only ever amplifies, never attenuates,
    and resets when the processor is flushed (seek, next stream).
  • VolumeBoostRenderersFactory installs the processor into the audio sink and keeps the
    wanted gain across the sinks that are rebuilt every time a player is created.
    CustomRenderersFactory now extends it, so both factories the player picks from
    support the boost.
  • The button is tinted while the audio is being amplified, so it is visible at a glance
    that the stream is not played back as it is.
  • The gain and the automatic mode are persisted in the preferences and restored on the
    next playback, like the playback speed already is.
  • The audio processors ExoPlayer adds itself are kept, so playback speed, pitch and
    silence skipping keep working alongside the boost.

Unit tests were added for the processor (amplification and clipping for both encodings,
empty input, clamping, and the automatic mode amplifying quiet audio, leaving loud audio
alone and resetting on flush) and for the new SliderStrategy.Linear.

Fixes the following issues

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane,
click on "CI", scroll down to "artifacts" and click "app" to download the zip file which
contains the debug APK of this PR. You can find more info and a video demonstration
on this wiki page.

Due diligence

Some streams are mastered so quietly that they are hard to hear even at
the maximum system volume. Add a volume boost, reachable from a new
speaker button in the player control bar, which amplifies the decoded
PCM samples before they reach the audio track.

The boost can either be picked by the user, from 100% up to 300%, or be
left to the player: in automatic mode the gain is derived in real time
from the loudness of the stream itself, so that quiet passages are
brought up while already loud ones are left untouched.

- VolumeBoostAudioProcessor amplifies 16 bit and float PCM samples,
  clipping whatever exceeds the range of the encoding. In automatic mode
  it measures the loudness (RMS) and the peak of every buffer, aims for
  about -16 dBFS, keeps the peak below full scale to limit clipping, and
  smooths the gain with a fast attack and a slow release so that sudden
  loud passages do not clip and quiet ones do not pump.
- VolumeBoostRenderersFactory installs that processor into the audio
  sink and keeps the wanted gain across the sinks which are rebuilt
  whenever a player is created. CustomRenderersFactory now extends it,
  so both factories the player picks from support the boost.
- The main player shows VolumeBoostDialog, with a slider and an
  "Adjust automatically" switch. The popup player, which has no activity
  to host a dialog, shows a menu of gains instead.
- The button is tinted while the audio is being amplified, so that it is
  obvious the stream is not played back as it is.
- Both the gain and the automatic mode are saved to the preferences and
  restored on the next playback, like the playback speed already is.

The audio processors ExoPlayer itself adds are kept, therefore playback
speed, pitch and silence skipping keep working alongside the boost.
@github-actions github-actions Bot added the size/giant PRs with more than 750 changed lines label Aug 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

@TobiGr TobiGr added feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background) labels Aug 13, 2026
@ShareASmile ShareASmile added the UX Relating to improving user experience label Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Issue is related to a feature in the app player Issues related to any player (main, popup and background) size/giant PRs with more than 750 changed lines UX Relating to improving user experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an optional audio preamplifier (> 100% volume) for videos with low volume or devices with weak speakers

3 participants