skip to Main Content

I attempted to play a.wav file with pyaudio. It works fine in Windows, but not in Ubuntu when another device is using sound.

and got this error:

The error is "IOError: [Errorno Invalid output device (no default output device)] -9996

Is there another way?

2

Answers


  1. Did you try wxPython
    as example:

    sound.Play(wx.SOUND_ASYNC)
    

    and sound variable can be defined like this:

    sound = wx.Sound('sound.wav')
    

    you can see this question as reference seems you have the same problem.
    What's a cross platform way to play a sound file in python?

    Login or Signup to reply.
  2. simply use simpleaudio

    import simpleaudio
    wave_obj = simpleaudio.WaveObject.from_wave_file("sound.wav")
    play_obj = wave_obj.play()
    play_obj.wait_done()
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search