Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Sound Pausing with APE Files Compared to Other Formats
Qt 6.11 is out! See what's new in the release blog

Sound Pausing with APE Files Compared to Other Formats

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 2 Posters 933 Views 1 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.
  • K Offline
    K Offline
    KitaharaHaruki
    wrote on last edited by
    #1

    Windows 11,PyQt6 version: 6.6.1

    I am a beginner in programming with PyQt, and in the following simple music player example, there is a strange phenomenon that is difficult to explain.

    214427.png

    APE files cause a 2 to 3-second delay here, and the sound also pauses for 2 to 3 seconds.
    For other file types such as mp3, wav, flac, tta, dsf, etc., the delay here is approximately 0.06 to 1.0 seconds, but there is no issue of any sound pause.

    On the other hand, playing APE files using the command line tool ffplay is normal and does not have the issue of sound pause.

    Furthermore, if a normally playing audio file is converted to APE format, the issue of sound pause will occur.

    Lastly, it's worth mentioning that if I use PyQt5 with LAV Filters as the backend, I can play these APE files normally.

    # PyQt6 version: 6.6.1
    import sys
    
    from PyQt6.QtCore import QUrl
    from PyQt6.QtMultimedia import QMediaPlayer, QAudioOutput
    from PyQt6.QtWidgets import QApplication, QMainWindow
    
    
    class MyAudioPlayer(QMainWindow):
        def __init__(self):
            super().__init__()
            self.player = QMediaPlayer()
            self.audioOutput = QAudioOutput()
            self.player.setAudioOutput(self.audioOutput)
            self.player.positionChanged.connect(self.positionChanged)
            self.player.durationChanged.connect(self.durationChanged)
            self.player.playbackStateChanged.connect(self.stateChanged)
            self.player.errorOccurred.connect(self._player_error)
            self.audioOutput.setVolume(1)
    
        def positionChanged(self, position):
            print(f'positionChanged: {position}')
    
        def durationChanged(self, duration):
            print(f'durationChanged: {duration}')
    
        def stateChanged(self, state):
            print(f'stateChanged: {state}')
    
        def _player_error(self, error, error_string):
            print(error, error_string)
    
        def play(self):
            fp = "D:/Downloads/test/test.ape"  # mp3, wav, flac, tta, dsf...      OK
            print(QUrl.fromLocalFile(fp))
            self.player.setSource(QUrl.fromLocalFile(fp))
            self.player.play()
    
    
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        audioPlayer = MyAudioPlayer()
        audioPlayer.show()
        audioPlayer.play()
        sys.exit(app.exec())
    
    1 Reply Last reply
    0
    • SGaistS SGaist moved this topic from General and Desktop on
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Do you have the same behaviour with PySide6 ?

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

      K 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Do you have the same behaviour with PySide6 ?

        K Offline
        K Offline
        KitaharaHaruki
        wrote on last edited by
        #3

        @SGaist
        Yes, PySide6 (ver 6.6.2) also has the exact same issue as PyQt6.

        SGaistS 1 Reply Last reply
        0
        • K KitaharaHaruki

          @SGaist
          Yes, PySide6 (ver 6.6.2) also has the exact same issue as PyQt6.

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

          @KitaharaHaruki can you share the command you use to convert your sound file to the APE format ?

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

          K 1 Reply Last reply
          0
          • SGaistS SGaist

            @KitaharaHaruki can you share the command you use to convert your sound file to the APE format ?

            K Offline
            K Offline
            KitaharaHaruki
            wrote on last edited by
            #5

            @SGaist
            I am simply using the foobar2000 software interface for format conversion operations. However, the issue mentioned above is not related to file size. For example, converting a very small MP3 file (about 5MB) to APE format still results in the same problem.

            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