force use of alsa when using QSound

  • Hi,
    I'm trying to run a qt app in a raspberry pi in a minimal fashion.
    to keep things minimal i opted not to install pulseaudio and instead use just also.
    now when I play an audio file qt tries to play it using pulseaudio instead of alsa, how can I tell it to use alsa instead?

    a simple app to demonstrate the problem:

    import sys
    from PyQt5 import QtWidgets as qtw
    from PyQt5.QtMultimedia import QSound,QAudioDeviceInfo,QAudio
    class mainwindow(qtw.QWidget):
        def __init__(self,*args, **kwargs):
            super().__init__(*args, **kwargs)
            self.gridLayout = qtw.QGridLayout()
   = qtw.QPushButton('play sound')
            say = QSound("reactivate.wav")
    app = qtw.QApplication(sys.argv)
    w = mainwindow()
    ret = app.exec_()

    when running the app on a system that uses pulseaudio or in windows the app works as expected, but when I move the app to the raspberrypi and run it it shows this:

    PulseAudioService: pa_context_connect() failed
    which should obviously not be happening since it should fallback to alsa, so how can I force qt to use alsa instead?

Log in to reply