@@ -0,0 +1,793 @@
+#!/usr/bin/env python%0A%0A%22%22%22PyAudio Example: Play a wave file (callback version)%22%22%22%0A%0Aimport pyaudio%0Aimport wave%0Aimport time%0Aimport sys%0A%0Aif len(sys.argv) %3C 2:%0A    print(%22Plays a wave file.%5Cn%5CnUsage: %25s filename.wav%22 %25 sys.argv%5B0%5D)%0A    sys.exit(-1)%0A%0Awf = wave.open(sys.argv%5B1%5D, 'rb')%0A%0Ap = pyaudio.PyAudio()%0A%0A%0Adef callback(in_data, frame_count, time_info, status):%0A    data = wf.readframes(frame_count)%0A    return (data, pyaudio.paContinue)%0A%0A%0Astream = p.open(format=p.get_format_from_width(wf.getsampwidth()),%0A                channels=wf.getnchannels(),%0A                rate=wf.getframerate(),%0A                output=True,%0A                stream_callback=callback)%0A%0Astream.start_stream()%0A%0Awhile stream.is_active():%0A    time.sleep(0.1)%0A%0Astream.stop_stream()%0Astream.close()%0Awf.close()%0A%0Ap.terminate()%0A

add play_callback