Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slowdown and Speedup a song that is being played #774

Open
phalgunlolur opened this issue Dec 14, 2021 · 5 comments
Open

Slowdown and Speedup a song that is being played #774

phalgunlolur opened this issue Dec 14, 2021 · 5 comments

Comments

@phalgunlolur
Copy link

Hello,

This is a feature request.

I was wondering if it would be possible to slow down a song that's being played by a specific amount (50%, for example) or speed it up on the fly

@virtuald
Copy link
Member

I think I played with this a few years ago. We would only be able to implement this in Exaile if gstreamer had a plugin that Exaile could leverage to do it for us, and IIRC there was one but it made the audio sound pretty terrible? It's possible the situation has changed since then.

Here's a gstreamer plugin that might do this. I'm not sure if this is the one I tried. https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-scaletempo.html

@phalgunlolur
Copy link
Author

Do I directly install this plugin through Exaile's plugin options?

@virtuald
Copy link
Member

Oh, sorry. Those details are for anyone who might want to implement the requested feature. You can't use gstreamer plugins directly without modifying Exaile's code.

@phalgunlolur
Copy link
Author

Gotcha. I was reading that traktor is able to do this natively, but I haven't verified it

@virtuald
Copy link
Member

Looking through my development directory, I noticed that my initial testing of the gstreamer plugin is still there... it's basically the same as the replaygain plugin:

from xl import providers, event, settings
from xl.player.gst.gst_utils import ElementBin

from gi.repository import Gst


NEEDED_ELEMS = ["scaletempo"]


def enable(exaile):
    for elem in NEEDED_ELEMS:
        if not Gst.ElementFactory.find(elem):
            raise ImportError("Needed gstreamer element %s missing." % elem)
    providers.register("gst_audio_filter", ScaleTempo)


def disable(exaile):
    providers.unregister("gst_audio_filter", ScaleTempo)


class ScaleTempo(ElementBin):
    """
    Handles replaygain volume adjustment and pre-amp.

    Placed at 30 in the pipeline, since most elements should do their
    processing after it.
    """

    index = 30
    name = "scaletempo"

    def __init__(self):
        ElementBin.__init__(self, name=self.name)
        self.audioconvert = Gst.ElementFactory.make("audioconvert", None)
        self.elements[40] = self.audioconvert
        self.tempo = Gst.ElementFactory.make("scaletempo", None)
        self.tempo.rate = 2
        self.elements[50] = self.tempo
        self.setup_elements()

There's still a lot of UI work that would need to be done for someone to actually use this (for example, it speeds up every song by 2x).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants