MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.12k stars 341 forks source link

Can mpd set playback speed? #46

Open guraga opened 7 years ago

guraga commented 7 years ago

Please, implement playback speed control.

tremby commented 6 years ago

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.

vonpupp commented 6 years ago

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

PaoJiao commented 6 years ago

+1... mpv has this feature.

andmarti1424 commented 6 years ago

This would be great!

parml commented 5 years ago

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

nycex commented 5 years ago

+1

RomeuG commented 5 years ago

+1

dleslie commented 5 years ago

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

snippins commented 5 years ago

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.

dm17 commented 4 years ago

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.

54696d21 commented 4 years ago

please add this feature

your-diary commented 4 years ago

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.

dm17 commented 4 years ago

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

rohshall commented 1 year ago

+1 for this feature

gnomon- commented 1 year ago

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.

hexadecagram commented 8 months ago

@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.

titaniumtraveler commented 6 months ago

@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.

mrtnvgr commented 5 months ago

+1 🙏🏻

Sprinter05 commented 4 months ago

+1