diff --git a/play-test.py b/play-test.py deleted file mode 100644 index 34c5d69..0000000 --- a/play-test.py +++ /dev/null @@ -1,33 +0,0 @@ -"""PyAudio Example: Play a wave file.""" - -import wave -import sys - -import pyaudio - - -CHUNK = 1024 - -if len(sys.argv) < 2: - print(f'Plays a wave file. Usage: {sys.argv[0]} filename.wav') - sys.exit(-1) - -with wave.open(sys.argv[1], 'rb') as wf: - # Instantiate PyAudio and initialize PortAudio system resources (1) - p = pyaudio.PyAudio() - - # Open stream (2) - stream = p.open(format=p.get_format_from_width(wf.getsampwidth()), - channels=wf.getnchannels(), - rate=wf.getframerate(), - output=True) - - # Play samples from the wave file (3) - while len(data := wf.readframes(CHUNK)): # Requires Python 3.8+ for := - stream.write(data) - - # Close stream (4) - stream.close() - - # Release PortAudio system resources (5) - p.terminate()