Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMediaPlayer: How to keep the pitch of audio while changing playback rate (Windows 10)
Forum Updated to NodeBB v4.3 + New Features

QMediaPlayer: How to keep the pitch of audio while changing playback rate (Windows 10)

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 5 Posters 1.6k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shootah
    wrote on last edited by
    #1

    I am using QMediaPlayer to playback video files. This class has the setPlaybackRate method which is cool, but it changes the pitch of the sound.

    Is it possible to keep the pitch while changing the rate? I am on Windows 10.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      AFAIK, no. QtMultimedia is not made for advanced video manipulation like that.

      Out of curiosity, what are you trying to achieve ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Shootah
        wrote on last edited by
        #3

        Thanks for the answer and sorry for being a little late.

        I've implemented a video files viewer using QMediaPlayer. This class has the member playbackRate which is really working, but changes the pitch. I just want to keep the pitch while adding or decreasing the playback speed.

        I believe, this feature could be very useful for them who uses playbackRate property. E.g. Windows Media Player and some other players are keeping the pitch.

        SGaistS JoeCFDJ 2 Replies Last reply
        0
        • S Shootah

          Thanks for the answer and sorry for being a little late.

          I've implemented a video files viewer using QMediaPlayer. This class has the member playbackRate which is really working, but changes the pitch. I just want to keep the pitch while adding or decreasing the playback speed.

          I believe, this feature could be very useful for them who uses playbackRate property. E.g. Windows Media Player and some other players are keeping the pitch.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Shootah well, the pitch is dependent on the speed at which you play the sound track so I am really not sure to understand properly what effect you want to have.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SimonSchroeder
            wrote on last edited by
            #5

            Hearing does not work the same as seeing. It is quite simple to speed up a video: Just play the frames faster/skip some frames. It is quite simple. If you do the same with sound the pitch will change automatically. It is much harder to keep the pitch the same (I guess you'd have to use Fourier transform). It requires deep knowledge about sound/audio that you cannot expect someone at Qt to have. If you think Qt should have that, you can contribute it yourself. If you think it is too hard, well, you got the answer why it is not in Qt. (BTW, you will not get any features into Qt by mentioning it on the forum.)

            KH-219DesignK 1 Reply Last reply
            0
            • S SimonSchroeder

              Hearing does not work the same as seeing. It is quite simple to speed up a video: Just play the frames faster/skip some frames. It is quite simple. If you do the same with sound the pitch will change automatically. It is much harder to keep the pitch the same (I guess you'd have to use Fourier transform). It requires deep knowledge about sound/audio that you cannot expect someone at Qt to have. If you think Qt should have that, you can contribute it yourself. If you think it is too hard, well, you got the answer why it is not in Qt. (BTW, you will not get any features into Qt by mentioning it on the forum.)

              KH-219DesignK Offline
              KH-219DesignK Offline
              KH-219Design
              wrote on last edited by
              #6

              @SimonSchroeder said in QMediaPlayer: How to keep the pitch of audio while changing playback rate (Windows 10):

              It is much harder to keep the pitch the same (I guess you'd have to use Fourier transform). It requires deep knowledge about sound/audio that you cannot expect someone at Qt to have.

              I agree with @SimonSchroeder . Nonetheless, I subscribed to this question as soon as I saw it posted, because I was curious whether someone would link to a "famous" algorithm or some other well-known solution.

              Since nobody has, I did some "light Googling," and came up with:

              • https://en.wikipedia.org/wiki/Audio_time_stretching_and_pitch_scaling

              Wikipedia then points to: "Pitch-corrected audio timestretch is found in every modern web browser as part of the HTML standard for media playback. Similar controls are ubiquitous in media applications and frameworks such as GStreamer and Unity. "

              If you look at the "External Links" section of the Wikipedia page on timestretching, you also see:

              • ZTX Time Stretching Library Free and commercial versions of a popular 3rd party time stretching library for iOS, Linux, Windows and Mac OS X
              • TSM toolbox Free MATLAB implementations of various Time-Scale Modification procedures

              (among others)

              www.219design.com
              Software | Electrical | Mechanical | Product Design

              1 Reply Last reply
              1
              • S Shootah

                Thanks for the answer and sorry for being a little late.

                I've implemented a video files viewer using QMediaPlayer. This class has the member playbackRate which is really working, but changes the pitch. I just want to keep the pitch while adding or decreasing the playback speed.

                I believe, this feature could be very useful for them who uses playbackRate property. E.g. Windows Media Player and some other players are keeping the pitch.

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #7

                @Shootah This may help if you try to use a customized pipeline.
                https://gstreamer.freedesktop.org/documentation/soundtouch/pitch.html?gi-language=c
                and
                https://stackoverflow.com/questions/75456587/change-pitch-on-playback-with-gstreamer

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved