Skip to content
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

Merged
merged 8 commits into from
Dec 27, 2016
Merged

Trigger #20

merged 8 commits into from
Dec 27, 2016

Conversation

evancohen
Copy link
Owner

@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.

{file: 'snowboy.umdl', hotword: 'snowboy'}]
```

### Lenguages
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Languages

Copy link
Owner Author

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")
Copy link
Collaborator

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?

Copy link
Owner Author

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?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You used a string

Copy link
Owner Author

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`
Copy link
Collaborator

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)
Copy link
Collaborator

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
@evancohen evancohen merged commit 79587fa into master Dec 27, 2016
@evancohen evancohen deleted the trigger branch December 27, 2016 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants