Skip to content

Commit ea7477a

Browse files
committed
modified
1 parent a6ab160 commit ea7477a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/raspi_assistant/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def feedback(self, content=None):
6161
data.seek(0)
6262
convert_to_wav(data)
6363
data.close()
64-
self.audio_handler.aplay('output.wav')
64+
self.audio_handler.aplay()
6565

6666
def worker(self):
6767
results = self.receive()

examples/raspi_assistant/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _(*args, **kwargs):
6262
if cache:
6363
print 'cached'
6464
audio_handler = AudioHandler()
65-
audio_handler.play(BytesIO(base64.b64decode(cache)))
65+
audio_handler.aplay(base64.b64decode(cache), is_buffer=True)
6666
# return cache
6767
else:
6868
print 'set cache'
@@ -161,9 +161,9 @@ def arecord(self, record_seconds, is_buffer=False, file_=BC.INPUT_NAME):
161161
['arecord', '-r', '16000', '-D', 'plughw:1,0', '-f', 'S16_LE', '-d', str(record_seconds), file_])
162162
p.wait()
163163

164-
def aplay(self, is_buffer=False, file_=BC.OUTPUT_NAME):
164+
def aplay(self, file_=BC.OUTPUT_NAME, is_buffer=False):
165165
if is_buffer:
166-
p = Popen(['aplay', '-'], stdin=file_)
166+
p = Popen(['aplay', '-'], stdin=BytesIO(file_))
167167
else:
168168
p = Popen(['aplay', file_])
169169
p.wait()

0 commit comments

Comments
 (0)