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