Skip to content

Commit

Permalink
No file recorded?
Browse files Browse the repository at this point in the history
  • Loading branch information
klauer committed Oct 14, 2018
1 parent 34b441a commit d656288
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions voice_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ async def start(self, instance, async_lib):
async def start(self, instance, value):
duration, = self.duration.value

rec = sound.Recorder("recorded.m4a")
rec.record()
await self.async_lib.sleep(duration)
rec = sound.Recorder('recorded.m4a')
rec.record(duration)
for i in range(10):
print('Recording?', rec.recording)
await self.async_lib.sleep(duration / 10.)
rec.stop()
result = speech.recognize("recorded.m4a")
await self.async_lib.sleep(0.1)
result = speech.recognize('recorded.m4a')
print('Heard:', result)
await self.text.write([str(result)])

Expand Down

0 comments on commit d656288

Please sign in to comment.