gpodder-sailfish icon indicating copy to clipboard operation
gpodder-sailfish copied to clipboard

Feature request: playback speed control with pitch compensation

Open ortylp opened this issue 9 years ago • 24 comments

Use case: depending on podcast contents and situation the speed of playback should be adjustable at all times.

In my personal opinion a podcast player without speed control is unusable.

See if http://doc.qt.io/qt-5/qml-qtmultimedia-mediaplayer.html#playbackRate-prop can be used and/or adapted.

Another speed modyfying library is at https://github.com/waywardgeek/sonic

ortylp avatar Mar 08 '15 10:03 ortylp

playbackRate in Qt (at least on Sailfish OS) changes pitch, so that's a no-go.

Funnily, HTML5 audio does pitch-preserving playback rate changes, and it works in the Sailfish browser. So that'd be one dirty hack to get it running on SFOS before someone comes around and wraps sonic into a QML plugin for use.

thp avatar Mar 09 '15 20:03 thp

still a thing? Or not important?

thigg avatar Dec 04 '19 22:12 thigg

still a thing? Or not important?

It is THE missing feature, that prevents me from using gpodder again.

ortylp avatar Dec 05 '19 06:12 ortylp

Do you have a player on SFOS that does it with pitch compensation? I have in the past played with this but as thp said there was no pitch adjustment....

Keeper-of-the-Keys avatar Dec 05 '19 08:12 Keeper-of-the-Keys

Do you have a player on SFOS that does it with pitch compensation? I have in the past played with this but as thp said there was no pitch adjustment....

Not directly, I was/am using AntennaPod (Android).

This is a must have feature also on other platforms supported by gpodder, but I assume mobile phone OSes are a priority here.

ortylp avatar Dec 05 '19 08:12 ortylp

Have you tried this recently?

https://doc.qt.io/qt-5/qml-qtmultimedia-mediaplayer.html#playbackRate-prop

I don't remember if it corrects for pitch or not, and if it works properly for all media types, but if it does, that would be rather easy to expose in the UI (that already existed back then, but didn't fully work AFAIR).

Keeper-of-the-Keys [email protected] schrieb am Do., 5. Dez. 2019, 09:04:

Do you have a player on SFOS that does it with pitch control? I have in the past played with this but as thp said there was no pitch adjustment....

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gpodder/gpodder-sailfish/issues/29?email_source=notifications&email_token=AABBASISFF3X6EPVIJ77G23QXCYYHA5CNFSM4A5NBKVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEF73I6Y#issuecomment-562017403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABBASNWKOGGLLPCFOFICFLQXCYYHANCNFSM4A5NBKVA .

thp avatar Dec 05 '19 08:12 thp

Unfortunately I do not have any possibility to test it now.

My Jolla (The First One) after a year or so was powering down on any shock (like putting it on a table), so I switched to Android supported hardware. It is a real pity there is no non Sony hardware running SFOS :(

ortylp avatar Dec 05 '19 08:12 ortylp

I created a slider that allowed adjusting the playbackRate about a year ago I just never pushed it because it doesn't do pitch adjustment.

Keeper-of-the-Keys avatar Dec 05 '19 08:12 Keeper-of-the-Keys

@Keeper-of-the-Keys Could you add it, with needing to be activated in the settings or so and mark it as experimental maybe? I'd love to have it and wouldn't mind pitching too much, but unterstand that it's not a good default as of yet.

peperjohnny avatar Apr 08 '20 09:04 peperjohnny

I'll try to find the code for it (this was still done editing files on my phone, I did back it up though), however as far as I recall it was very much alpha quality with playback stopping if you changed the rate and other weird behavior.

Keeper-of-the-Keys avatar Apr 08 '20 10:04 Keeper-of-the-Keys

(Either way it will not be in the 4.11 release that we'll be doing any day now - sorry)

Keeper-of-the-Keys avatar Apr 08 '20 10:04 Keeper-of-the-Keys

No worries. If you want any testing beforehand, I can try this as well.

peperjohnny avatar Apr 09 '20 13:04 peperjohnny

@Keeper-of-the-Keys you found the code? I tried it with player.plabackRate=2.0 but it works only after play/pause and yes, it has pitch

thigg avatar Jul 11 '20 19:07 thigg

Got now a version with pitch, but a button which toggles playbackspeed on tap. My patches:

diff --git a/qml/PlayerPage.qml b/qml/PlayerPage.qml
index d7d5adc..562d4f5 100644
--- a/qml/PlayerPage.qml
+++ b/qml/PlayerPage.qml
@@ -236,6 +236,15 @@ Page {
                         onFired: player.seekAndSync(player.position + 1000 * 60)
                     }
                 }
+
+                IconMenuItem {
+                    text: qsTr("rate")
+                    icon.source: 'image://theme/icon-m-play'
+                    GPodderAutoFire {
+                        running: parent.down
+                        onFired: player.toggleSpeedup()
+                    }
+                }
             }
 
             SectionHeader {

And in gpodder-ui-qml:


diff --git a/common/GPodderPlayback.qml b/common/GPodderPlayback.qml
index f39da99..3799bba 100644
--- a/common/GPodderPlayback.qml
+++ b/common/GPodderPlayback.qml
@@ -230,6 +230,16 @@ MediaPlayer {
         onTriggered: player.flushToDisk();
     }
 
+    function toggleSpeedup(){
+        if(player.playbackRate >1){
+            player.playbackRate = 1;
+        }else{
+            player.playbackRate = 1.25;
+        }
+        sendPositionToCore(lastPosition);
+        seek(lastPosition);
+    }
+
     property var seekAfterPlayTimer: Timer {
         interval: 100
         repeat: true

thigg avatar Jul 11 '20 20:07 thigg

when sailfishos finally uses qt 5.12 this can be fixed by including scaletempo in the gstreamer pipeline via the source

thigg avatar Aug 15 '20 18:08 thigg

@Keeper-of-the-Keys you found the code? I tried it with player.plabackRate=2.0 but it works only after play/pause and yes, it has pitch

I haven't checked on my phone but it's not on my computer :/ But it used the same idea as you change the playbackRate

SFOS 3.4 looks like it's still on Qt 5.6 so no luck there (which is an even bigger bummer for the redirect issue)

Keeper-of-the-Keys avatar Oct 05 '20 22:10 Keeper-of-the-Keys

Only fix that comes to my mind is writing our own player where we have the gstreamer pipeline under control... Or use a webview

thigg avatar Oct 06 '20 09:10 thigg

Since SFOS 4.2 supports pitch correction I'd love to change playback speed in gPodder, however I haven't found a UI control to set the desired playback speed. Wouldn't it be rather simple to add a slider to the settings page?

dimpflmoser avatar Sep 15 '21 15:09 dimpflmoser

We added it to podqast, its a bit tricky to get the playbackspeed updated, but feel free to reuse our code from here

thigg avatar Sep 16 '21 14:09 thigg

Wow, I missed that in the release notes, I'll try to add this asap. @thigg thanks!

Keeper-of-the-Keys avatar Sep 16 '21 22:09 Keeper-of-the-Keys

ty, I was glad abaranson picked my research on this up

thigg avatar Sep 18 '21 07:09 thigg

@thigg thanks for everything! I'll be merging this and doing a release soon!

Keeper-of-the-Keys avatar Sep 23 '21 23:09 Keeper-of-the-Keys

There are two types of plugins supported in QMediaPlayer One is DirectShow and other is WindowsMediaFoundation Qmediaplayer support the old plugin bydefault (directshow) which changes the pitch when you change the speed. You just have to switch from directshow to windowsmediafoundation In PyQt5 Just write this line of code before importing anything import os os.environ['QT_MULTIMEDIA_PREFERRED_PLUGINS'] = "windowsmediafoundation"

mostuselessboy avatar Feb 26 '22 00:02 mostuselessboy

@mostuselessboy This is running on Linux (SailfisOS), so the backend is gstreamer unless I'm very much mistaken.

Keeper-of-the-Keys avatar Feb 26 '22 16:02 Keeper-of-the-Keys