0

Im trying to play "windows dang" sound with pyside6 Qsoundeffect heres: my code:

from PySide6.QtCore import QUrl
from PySide6.QtMultimedia import QSoundEffect
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        
        # Create QSoundEffect instance
        self.effect = QSoundEffect()
        self.effect.setSource(QUrl.fromLocalFile("C:\\Windows\\Media\\windows ding.wav"))
        
        # Create button to play sound effect
        button = QPushButton('Play Sound Effect', self)
        button.clicked.connect(self.play_sound_effect)
        self.setCentralWidget(button)
        
    def play_sound_effect(self):
        # Play the sound effect
        self.effect.play()
        
if __name__ == '__main__':
    app = QApplication([])
    window = MainWindow()
    window.show()
    app.exec_()

but I keep getting this error : qt.multimedia.audiooutput: Failed to set up resampler

  • It's 6.4.2 I think I dont have the qt it self I just have designer installed with pyside6 and I saw in help section that it's 6.4.2 – Pars_khodro Mar 10 '23 at 10:43
  • bug report is exactly against that version you reported and its fixed in 6.4.3 .. See the accepted answer in the SO link and check the option to for possible fix. – rasjani Mar 10 '23 at 11:04
  • @Pars_khodro You *do* have Qt installed, PySide is a Python binding against the C++ library, it doesn't work on its own. – musicamante Mar 10 '23 at 11:51
  • so is there a way to install 6.4.3 version ? or I should go back to 6.4.0.1 ? – Pars_khodro Mar 10 '23 at 11:58

0 Answers0