Sound Pausing with APE Files Compared to Other Formats
-
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.
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())
-
S SGaist moved this topic from General and Desktop on
-
Hi and welcome to devnet,
Do you have the same behaviour with PySide6 ?
-
@SGaist
Yes, PySide6 (ver 6.6.2) also has the exact same issue as PyQt6. -
@SGaist
Yes, PySide6 (ver 6.6.2) also has the exact same issue as PyQt6.@KitaharaHaruki can you share the command you use to convert your sound file to the APE format ?
-
@KitaharaHaruki can you share the command you use to convert your sound file to the APE format ?
@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.