evancohen / sonus

:speech_balloon: /so.nus/ STT (speech to text) for Node with offline hotword detection
MIT License
618 stars 79 forks source link

Implement a simple pause / resume #100

Open simon-tannai opened 4 years ago

simon-tannai commented 4 years ago

Hi !

I have implemented a simple pause() and resume() methods to have a solution to the issue that I met with the orginal methods (https://github.com/evancohen/sonus/issues/95)

evancohen commented 4 years ago

Thank you! Sorry for totally missing the notification for this PR.

From a quick glance your PR only stops keyword emission, which might lead to unexpected results. For example calling pause() in the middle of an utterance won't stop the audio stream from being set to the speech provider and detection will run until the end of the utterance. I think the "right" way to solve this is to mute the hardware device or the audio stream that being consumed by Sonus.

Going to keep this PR open, in case it helps anyone, at least until I manage to get around to fixing this.