This commit is contained in:
talksik
2023-04-29 16:11:07 -07:00
parent 73cc85fdeb
commit d907a16edd
2 changed files with 6 additions and 7 deletions
+5 -5
View File
@@ -17,11 +17,11 @@ wf = wave.open(sys.argv[1], 'rb')
p = pyaudio.PyAudio() p = pyaudio.PyAudio()
# open stream based on the wave object which has been input. # open stream based on the wave object which has been input.
stream = p.open(format = p.get_format_from_width(wf.getsampwidth()), stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
channels = wf.getnchannels(), channels=wf.getnchannels(),
rate = wf.getframerate(), rate=wf.getframerate(),
output = True, output=True,
output_device_index = RESPEAKER_INDEX) output_device_index=RESPEAKER_INDEX)
# read data (based on the chunk size) # read data (based on the chunk size)
data = wf.readframes(chunk) data = wf.readframes(chunk)
@@ -25,7 +25,6 @@ frames = []
for i in range(0, int(RESPEAKER_RATE / CHUNK * RECORD_SECONDS)): for i in range(0, int(RESPEAKER_RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK) data = stream.read(CHUNK)
print("read a chunk")
frames.append(data) frames.append(data)
print("* done recording") print("* done recording")