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

Sound Pausing with APE Files Compared to Other Formats

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 2 Posters 429 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.
  • K Offline
    K Offline
    KitaharaHaruki
    wrote on 26 Feb 2024, 14:50 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
    • S SGaist moved this topic from General and Desktop on 26 Feb 2024, 19:35
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 26 Feb 2024, 19:36 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 27 Feb 2024, 04:25
      0
      • S SGaist
        26 Feb 2024, 19:36

        Hi and welcome to devnet,

        Do you have the same behaviour with PySide6 ?

        K Offline
        K Offline
        KitaharaHaruki
        wrote on 27 Feb 2024, 04:25 last edited by
        #3

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

        S 1 Reply Last reply 27 Feb 2024, 21:21
        0
        • K KitaharaHaruki
          27 Feb 2024, 04:25

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

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 27 Feb 2024, 21:21 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 28 Feb 2024, 09:16
          0
          • S SGaist
            27 Feb 2024, 21:21

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

            K Offline
            K Offline
            KitaharaHaruki
            wrote on 28 Feb 2024, 09:16 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

            1/5

            26 Feb 2024, 14:50

            • Login

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