if len(sys.argv) < 2:
    print('Plays a wave file.\n\n' + 'Usage: %s filename.wav' % sys.argv[0])
sys.exit(-1)
wf = wave.open(sys.argv[1], 'rb')
p = pyaudio.PyAudio()
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()), channels
    =wf.getnchannels(), rate=wf.getframerate(), output=True)
data = wf.readframes(chunk)
while data != '':
    stream.write(data)
data = wf.readframes(chunk)
stream.close()
p.terminate()
Windows (XP to Windows 7) audio playback with python?