-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger #20
Conversation
{file: 'snowboy.umdl', hotword: 'snowboy'}] | ||
``` | ||
|
||
### Lenguages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Languages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
|
||
sonus.trigger = (index, hotword) => { | ||
if(sonus.started){ | ||
sonus.emit('hotword', index || "0", hotword || "triggered") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you actually want string 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should fallback to zero, but I think in order to best support all scenarios users should be able to pass in an index and a hotword to the trigger function (to accurately simulate the triggering of a specific hotword in case they have hotwords that perform different actions).
Proposed API
Sonus.trigger(sonus)
// Triggers sonus instance with index 0 and hotword "triggered"
Sonus.trigger(sonus, 1, "sonus")
//Triggers sonus instance with index 0 and hotword "sonus"
High flexibility and easy to use, or is this crazy 🍌s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You used a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - it's actually supposed to be a string... My proposal was wrong.
@@ -80,21 +80,31 @@ Sonus.stop(sonus) | |||
Note that after recognition is stopped it can not be started again without creating an enterly new sonus instance. | |||
|
|||
### Trigger keyword/hotword manually | |||
You can manuall trigger a hotword by passing your initialized sonus object into `Sonus.trigger` | |||
This will throw a `NOT_STARTED` exception if you have not started sonus when this is called. | |||
You can manuall trigger a hotword by passing your initialized sonus object and an index into `Sonus.trigger` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
sonus.emit('hotword', index, triggerHotword) | ||
CloudSpeechRecognizer.startStreaming(opts, sonus.mic, csr) | ||
} catch (e) { | ||
console.log(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.error
remove console.log
@ashishsc
Adding sonus hotword trigger and documentation that I wrote on the plane :)
Wasn't sure if this was really the right approach for the trigger, let me know what you think.