fixing bugs
This commit is contained in:
+3
-1
@@ -43,13 +43,14 @@ class Audio:
|
|||||||
def stopRecord(self, play=True, save=False):
|
def stopRecord(self, play=True, save=False):
|
||||||
print("* done recording")
|
print("* done recording")
|
||||||
self.recordStream.stop_stream()
|
self.recordStream.stop_stream()
|
||||||
self.frames = []
|
|
||||||
|
|
||||||
if save:
|
if save:
|
||||||
self._saveFile()
|
self._saveFile()
|
||||||
if play:
|
if play:
|
||||||
self._playFrames()
|
self._playFrames()
|
||||||
|
|
||||||
|
self.frames = []
|
||||||
|
|
||||||
def _saveFile(self):
|
def _saveFile(self):
|
||||||
wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
|
wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
|
||||||
wf.setnchannels(RESPEAKER_CHANNELS)
|
wf.setnchannels(RESPEAKER_CHANNELS)
|
||||||
@@ -61,6 +62,7 @@ class Audio:
|
|||||||
|
|
||||||
def _playFrames(self):
|
def _playFrames(self):
|
||||||
print("* playing recorded audio")
|
print("* playing recorded audio")
|
||||||
|
print(self.frames)
|
||||||
|
|
||||||
playbackStream = self.pyaudio.open(
|
playbackStream = self.pyaudio.open(
|
||||||
format=self.pyaudio.get_format_from_width(RESPEAKER_WIDTH),
|
format=self.pyaudio.get_format_from_width(RESPEAKER_WIDTH),
|
||||||
|
|||||||
Reference in New Issue
Block a user