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. Gapless audio playback

Gapless audio playback

Scheduled Pinned Locked Moved Unsolved General and Desktop
playbackaudio
12 Posts 3 Posters 1.4k Views
  • 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.
  • 3 Offline
    3 Offline
    3beezer
    wrote on last edited by
    #1

    Does an example exist (preferably in Python) of how to use QMediaGaplessPlaybackControl? I have QMediaPlayer working to play a sound file, but now I would like to add the ability to segue from one sound file to another without a gap. The documentation is unusually opaque, even for Qt.

    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      https://forum.qt.io/topic/109492/play-small-audio-files-without-gaps/6

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      1
      • 3 Offline
        3 Offline
        3beezer
        wrote on last edited by
        #3

        Thanks for pointing me to that thread, but it does not actually present a solution to the problem. I believe that the solution involves QMediaGaplessPlaybackControl, but I can't find any documentation explaining how to use that class. The documentation says, "If a QMediaService supports gapless playback it will implement QMediaGaplessPlaybackControl". Am I supposed to create a QMediaService or is there a QMediaService that already supports gapless playback? If I create a QMediaService, how do I make it subsume the functions of QMediaPlayer? What is a QMediaService? Maybe an example of creating a QMediaService -- even one that does not involve gapless playback -- would be helpful.

        1 Reply Last reply
        0
        • 3 Offline
          3 Offline
          3beezer
          wrote on last edited by
          #4

          I found this source code in git. If I understand correctly that I am looking at the source code for Qt, then it appears that gapless playback has not been implemented. Do I have this assessment right?

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

            Hi,

            You are looking at the interface the backend needs to implement to provide gapless playback.

            One way to check is to request the corresponding control from your QMediaPlayer. If it's nullptr then the platform doesn't support it currently (depending on the platform there might be no support at all)

            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
            • 3 Offline
              3 Offline
              3beezer
              wrote on last edited by
              #6

              Thanks for the reply.

              player = QMediaPlayer()
              player.service().requestControl("org.qt-project.qt.mediagaplessplaybackcontrol/5.0")

              returns None, so I presume that my platform (Kubuntu 19.10) does not support gapless playback -- unless the command I used to request the control is not correct. It appears that I am running Qt 5.12.4.

              1 Reply Last reply
              0
              • fcarneyF Offline
                fcarneyF Offline
                fcarney
                wrote on last edited by
                #7

                The link I provided talked about using 2 players to do gapless playback. The concept would be the same for whatever player you are using.

                Maybe if you describe the context of how you are using this then people might be able to help better.

                C++ is a perfectly valid school of magic.

                1 Reply Last reply
                1
                • 3 Offline
                  3 Offline
                  3beezer
                  wrote on last edited by 3beezer
                  #8

                  Some CDs have multiple tracks for a single movement of a symphonic work or a single act of an opera. When I rip the CD, I get multiple sound files corresponding to that one movement or act. The transition from one sound file to the next has to happen at exactly the right time without any crossfade. I could assemble the sound files into a single sound file, but then I lose the ability to jump directly to a particular section of the movement or a particular scene within an act.

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

                    What OS are you on ?

                    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
                    • 3 Offline
                      3 Offline
                      3beezer
                      wrote on last edited by
                      #10

                      Kubuntu 19.10.

                      1 Reply Last reply
                      0
                      • 3 Offline
                        3 Offline
                        3beezer
                        wrote on last edited by
                        #11

                        Does anyone know whether it is possible to use GStreamer with Qt? Normally GStreamer uses GObject for the event loop. Is it possible to use GStreamer with the event loop in Qt instead? I am asking about GStreamer because it does support gapless audio playback.

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

                          The Linux backend uses GStreamer. You can take a look at the code and maybe modify it for your purpose.

                          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

                          • Login

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