Kitt-AI / snowboy

Future versions with model training module will be maintained through a forked version here: https://github.com/seasalt-ai/snowboy
Other
3.1k stars 999 forks source link

Detector thread #411

Open kenanEkici opened 6 years ago

kenanEkici commented 6 years ago

I am currently working to combine Google Assistant and Snowboy. However, I am using multithreading in order to make this work. The only issue I have encountered so far is that the detector.start() seems to be a never ending thread. Because Google Assistant relies on the detector thread to end, this becomes an issue. I currently solved this by placing a "break" in the while loop in snowboydecoder.py the moment the given callback function is called. I believe Snowboy was meant to run on the main thread initially? The underlying code of the demo seems to fail when shifting away to multithreading.

chenguoguo commented 6 years ago

The best structure should look like this:

  1. You have audio capture running in the main thread
  2. You send the the captured audio to Snowboy for hotword detection
  3. You route the captured audio to Google Assistant once the hotword is detected
  4. You route the audio back go Snowboy once you finish your work with Google Assistant

You will have to write your own code though.

People have tried to save the audio to a file after the detection, see https://github.com/Kitt-AI/snowboy/blob/master/examples/Python/demo4.py

People have also tried to stop the recording session after the hotword is detected, see here https://github.com/Kitt-AI/snowboy/issues/12