Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Gapless audio playback

    General and Desktop
    playback audio
    3
    12
    530
    Loading More Posts
    • 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
      3beezer last edited by

      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 Reply Quote 0
      • fcarney
        fcarney last edited by

        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 Reply Quote 1
        • 3
          3beezer last edited by

          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 Reply Quote 0
          • 3
            3beezer last edited by

            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 Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              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 Reply Quote 0
              • 3
                3beezer last edited by

                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 Reply Quote 0
                • fcarney
                  fcarney last edited by

                  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 Reply Quote 1
                  • 3
                    3beezer last edited by 3beezer

                    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 Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      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 Reply Quote 0
                      • 3
                        3beezer last edited by

                        Kubuntu 19.10.

                        1 Reply Last reply Reply Quote 0
                        • 3
                          3beezer last edited by

                          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 Reply Quote 0
                          • SGaist
                            SGaist Lifetime Qt Champion last edited by

                            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 Reply Quote 0
                            • First post
                              Last post