Skip to content

Playback Speed - #1667

Open
LMSSonos wants to merge 5 commits into
LMS-Community:public/9.2from
LMSSonos:feature/playback-speed
Open

LMSSonos wants to merge 5 commits into
LMS-Community:public/9.2from
LMSSonos:feature/playback-speed

Conversation

@LMSSonos

@LMSSonos LMSSonos commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Added option to change playback speed
Feature must be activated per player in the settings -> audio options
Feature shows up in Trackinfo so that it can be changed on local device

@LMSSonos
LMSSonos marked this pull request as ready for review September 16, 2026 11:17
LMSSonos and others added 5 commits September 16, 2026 11:18
Adds a "speed" mixer feature (50-200%, applied via sox tempo in the
transcoding pipeline) alongside the existing volume/bass/treble/pitch
controls, with a speed dropdown on the Now Playing web UI. Speed
changes reopen the current track at its playback position rather than
restarting it, for mp3/flac/aac/mp4 sources.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: LMSSonos <sonos@envamo.com>
playingSongElapsed() combined startOffset with the player's raw
songElapsedSeconds(), but that value is measured in the transcoded
output stream's own timeline, which sox's tempo effect compresses or
stretches relative to the original track. It needs to be scaled by
the current speed before being added to startOffset, or songTime()
drifts from the real position whenever speed != 100.

mixerCommand's reopen-at-current-position logic also read songTime()
after already writing the new speed pref, so once songTime() scales
by the current speed, time played under the old speed would get
scaled by the new one instead. Capture the position before changing
the pref, then reopen with that saved value.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: LMSSonos <sonos@envamo.com>
…pen bugs

Settings > Audio gets a new "Playback Speed Control" dropdown (off by
default) that enables the Now Playing speed control and optionally
resets it to 1x at the start of every track, or only when the album
changes (so audiobook chapters keep the chosen speed). Disabling the
setting doesn't clear the stored speed value, so TranscodingHelper and
StreamingController's elapsed-time scaling now gate on the player
actually having speed enabled, not just on that stored value, or a
leftover non-100 value could keep quietly driving the tempo effect.

The reset hook uncovered several bugs in the existing live-reopen
mechanism along the way:
- Song::open() only requests transcoder-level seek when
  Song::canSeek() == 2, and canSeek() caches its result the first time
  anything queries it - often earlier in the track's life, while speed
  was still 100 and no transcoding was needed, caching it as 1 instead
  of 2. Every later speed-change reopen then silently restarted the
  track from 0 instead of resuming. Fixed by clearing that cache right
  before the reopen.
- Client::pluginData($key) as a single-arg getter only returns a
  per-key value for plugin callers; for any other caller it silently
  returns the whole data hash instead. That broke the "only reset on a
  genuine track change" guard (a hashref is never numerically equal to
  an integer song index), so with a reset policy enabled, the
  speed-change reopen kept re-triggering its own reset back to 1x.
- Skip the reopen entirely within 2s of a track's end - asking the
  decoder to seek to virtually the end of the file produced harmless
  but alarming decoder/pipe errors for no audible benefit.
- Subscribing to 'playlist newsong' at Commands.pm's top level broke
  server startup (Request.pm is still mid-compile when it `use`s
  Commands.pm, so Request::subscribe() doesn't exist yet); moved the
  subscribe call into Request::init(), which runs at actual server
  startup once everything is loaded.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: LMSSonos <sonos@envamo.com>
The web UI already exposes speed via a dropdown, but that's a
skin-specific control - hardware players and apps navigate menus built
from Slim::Menu::TrackInfo's OPML-based info providers instead (the
same family that surfaces "Remove from playlist", "Play", and
plugin-added items like a streaming service's "On: <Service>" entry).

Adds a jive-only "speed" provider next to "Play" offering the same
1.0x-2.0x choices as the web dropdown, gated the same way (hidden
unless the player has speed enabled) plus a check that it's only shown
for the track that's actually playing, since this is a player setting
rather than a per-track one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: LMSSonos <sonos@envamo.com>
The repo owner doesn't want this file in the upstream repo. It's still
useful as local working notes, so keep it on disk and ignore it going
forward rather than deleting it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: LMSSonos <sonos@envamo.com>
@LMSSonos
LMSSonos force-pushed the feature/playback-speed branch from 2c5011b to ce46ad7 Compare September 16, 2026 11:19
@LMSSonos LMSSonos changed the title Feature/playback speed Playback Speed Sep 16, 2026
@LMSSonos

Copy link
Copy Markdown
Contributor Author

As discussed in #1342 tested as follow

  • Change speed for flac and mp3 music works
  • Change speed for native podcast app works
  • Change speed for Bookish (audiobookshelf) works
  • Change speed for Spotty tracks => DOES NOT WORK

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.

1 participant