Play WAV file in Python

You can use PyAudio. An example here on my Linux it works: #!usr/bin/env python #coding=utf-8 import pyaudio import wave #define stream chunk chunk = 1024 #open a wav format music f = wave.open(r”/usr/share/sounds/alsa/Rear_Center.wav”,”rb”) #instantiate PyAudio p = pyaudio.PyAudio() #open stream stream = p.open(format = p.get_format_from_width(f.getsampwidth()), channels = f.getnchannels(), rate = f.getframerate(), output = True) #read … Read more

how to play wav file in python?

You can use PyAudio. An example here on my Linux it works: #!usr/bin/env python #coding=utf-8 import pyaudio import wave #define stream chunk chunk = 1024 #open a wav format music f = wave.open(r”/usr/share/sounds/alsa/Rear_Center.wav”,”rb”) #instantiate PyAudio p = pyaudio.PyAudio() #open stream stream = p.open(format = p.get_format_from_width(f.getsampwidth()), channels = f.getnchannels(), rate = f.getframerate(), output = True) #read … Read more