fixing bugs

This commit is contained in:
talksik
2023-04-27 14:40:22 -07:00
parent bd88b40005
commit bebec79662
+3 -1
View File
@@ -43,13 +43,14 @@ class Audio:
def stopRecord(self, play=True, save=False):
print("* done recording")
self.recordStream.stop_stream()
self.frames = []
if save:
self._saveFile()
if play:
self._playFrames()
self.frames = []
def _saveFile(self):
wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
wf.setnchannels(RESPEAKER_CHANNELS)
@@ -61,6 +62,7 @@ class Audio:
def _playFrames(self):
print("* playing recorded audio")
print(self.frames)
playbackStream = self.pyaudio.open(
format=self.pyaudio.get_format_from_width(RESPEAKER_WIDTH),