c++qtqmediaplayerplayback-rate

Changin mp3 speed in Qt and C++ [QMediaPlayer]


I'm trying to develop a little application in which you can load a mp3 file and play it in variable speeds! (I know it already exists :-) )

I'm using Qt and C++. I already have the basic player but I'm stuck with the rate thing, because I want to change the rate smoothly (like in Mixxx) without stopping the playback! The QMediaPlayer always stops if I change the value and creates a gap in the sound. Also I don't want the pitch to change!

I already found something called "SoundTouch" but now I'm completely clueless what to do with it, how to process my mp3 data and how to get it to the player! The "SoundTouch" Library is capable of doing what I want, i got that from the samples on the homepage.

Any help appreciated! I'm also open to any another solution then "SoundTouch" as long as I can stay with Qt/C++!

(Second thing: I want to view a waveform overview aswell as moving part of it (around actual position of the song), so I could also use hints on how to get the waveform data)

Thanks in advance!


Solution

  • As of now (Qt 5.5) this is impossible to do with QMediaPlayer only. You need to do the following:

    This strategy uses Qt as much as possible, and brings you the best platform coverage (you still lose Android though as it does not support QAudioOutput)