Skip to content
Advertisement

how to play wav file in python?

I tried pygame for playing wav file like this:

JavaScript

but It change the voice and I don’t know why! I read this link solutions and can’t solve my problem with playing wave file!

for this solution I dont know what should I import?

JavaScript

and for this solution /dev/dsp dosen’t exist in new version of linux :

JavaScript

and when I tried pyglet It give me this error:

JavaScript

Advertisement

Answer

You can use PyAudio. An example here on my Linux it works:

JavaScript
Advertisement