MPD icon indicating copy to clipboard operation
MPD copied to clipboard

Can mpd set playback speed?

Open guraga opened this issue 8 years ago • 24 comments

Please, implement playback speed control.

guraga avatar May 16 '17 14:05 guraga

Perhaps related, I'd also love to see pitch control without affecting playback speed. I've fiddled with Pulseaudio plugins which are supposed to achieve this, but they were an incredible pain to get working and to change configuration (such as pitch).

But I fear this and your request are probably both out of MPD's scope.

tremby avatar Jul 30 '17 02:07 tremby

Playback speed similar to youtube: 2x, 1.5x, 0.5x, etc would be amazing.

vonpupp avatar Nov 05 '17 12:11 vonpupp

+1... mpv has this feature.

PaoJiao avatar Nov 30 '17 05:11 PaoJiao

This would be great!

andmarti1424 avatar Jul 17 '18 15:07 andmarti1424

+1, please add this feature, grand mpd developers!

parml avatar Sep 30 '18 16:09 parml

+1

nycex avatar Oct 07 '18 17:10 nycex

+1

abc123098123 avatar Oct 13 '18 09:10 abc123098123

Being able to toggle/cycle through speed/pitch settings would be wonderful, as well. Or enabling/disabling them by name.

dleslie avatar Feb 19 '19 21:02 dleslie

Beside music, I use other mpd configs/instances for listening to podcasts and audiobooks. This feature would be a big big help for these things.

snippins avatar Jun 05 '19 09:06 snippins

It is a must have for me. I still use mplayer so that I can do '[' or ']' to change the speed, useful for music. It can change the tempo (without pitch shift) too, useful for audio books.

dm17 avatar Dec 08 '19 00:12 dm17

please add this feature

54696d21 avatar Feb 24 '20 05:02 54696d21

I strongly desire the feature to be implemented. The playback speed configuration is essential for music players. With the feature, mpd would be a lightweight but powerful alternative for all kinds of music player applications.

your-diary avatar May 11 '20 13:05 your-diary

Maybe there is an inexpensive way to have better feature parity with mplayer?

dm17 avatar May 11 '20 14:05 dm17

+1 for this feature

rohshall avatar Jun 04 '23 15:06 rohshall

I have implemented this feature as a set of configuration options. Specifically I used..:

  1. the filter directive to lean on ffmpeg's libavfilter...
  2. ...to use ffmpeg's filtergraph facility...
  3. ...to call the rubberband filter...
  4. ...which wraps the librubberband high-quality time-stretching / pitch shifting library...
  5. ...which I then expose to my mpd clients via a set of output directives that call the filter directives configured to expose different playback speeds.

That is, I now have these five filter directives in my mpd.conf:

# Filters #####################################################################
filter {
        plugin "ffmpeg"
        name   "speed 125%"
        graph  "rubberband=tempo=1.25"
}
filter {
        plugin "ffmpeg"
        name   "speed 150%"
        graph  "rubberband=tempo=1.5"
}
filter {
        plugin "ffmpeg"
        name   "speed 200%"
        graph  "rubberband=tempo=2"
}
filter {
        plugin "ffmpeg"
        name   "speed 250%"
        graph  "rubberband=tempo=2.5"
}
filter {
        plugin "ffmpeg"
        name   "speed 300%"
        graph  "rubberband=tempo=3"
}
###############################################################################

...plus these six output directives:

audio_output {
        type            "osx"
        name            "My OS X Device"
#       device          "Built-in Output"       # optional
#       channel_map      "-1,-1,0,1"    # optional
}

audio_output {
        type            "osx"
        name            "My OS X Device (125% speed)"
        filters         "speed 125%"
}
audio_output {
        type            "osx"
        name            "My OS X Device (150% speed)"
        filters         "speed 150%"
}
audio_output {
        type            "osx"
        name            "My OS X Device (200% speed)"
        filters         "speed 200%"
}
audio_output {
        type            "osx"
        name            "My OS X Device (250% speed)"
        filters         "speed 250%"
}
audio_output {
        type            "osx"
        name            "My OS X Device (300% speed)"
        filters         "speed 300%"
}

It is admittedly a bit clunky to abuse the output selection mechanism like this - by default all the outputs are enabled simultaneously so after each mpd daemon restart I have to run mpc enable only 1; toggling between different output speeds stops audio playback and I have to manually resume it; and in one room I use multiple outputs to control a multi-room configuration, and this solution would conflict with that setup - but by jove it works. The playback percentage counter even keeps up correctly.

gnomon- avatar Jun 06 '23 17:06 gnomon-

@gnomon- 's solution does not seem to work for the shout output plugin, presumably because it just streams and doesn't go through ffmpeg at all. Any thoughts?

I discovered Liquidsoap recently, which I've read should be able to handle some interesting streaming problems, but I currently cannot build it on ArchLinux. However, it seems that due to the nature of this feature, it would require the shout output plugin to support it directly.

hexadecagram avatar Oct 28 '23 02:10 hexadecagram

@gnomon-'s solution worked really well for me, though I switch from the rubberband=tempo=<tempo> to atempo=1.75 filter, which seems to yield better audio quality for me.

Also audio_output has a field called enabled, which can be set whether the audio_output is enabled by default.

titaniumtraveler avatar Jan 02 '24 07:01 titaniumtraveler

+1 🙏🏻

mrtnvgr avatar Feb 03 '24 16:02 mrtnvgr

+1

Sprinter05 avatar Mar 12 '24 15:03 Sprinter05