Skip to content

Commit 83cb06d

Browse files
authored
Merge branch 'dev' into patch-1
2 parents bb6c3e9 + 5a5fec1 commit 83cb06d

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ brew install sox
5252
Configure out cloud speech recognition system of choice, like [Google Cloud
5353
Speech API](https://cloud.google.com/speech/docs/getting-started).
5454

55+
__Note:__ You need to use the `GOOGLE_APPLICATION_CREDENTIALS` environment variable for your JSON keyfile.
56+
5557
Add sonus and said recognizer:
5658
``` javascript
5759
const Sonus = require('sonus')
58-
const speech = require('@google-cloud/speech')({
59-
projectId: 'streaming-speech-sample',
60-
keyFilename: './keyfile.json'
61-
})
60+
const speech = require('@google-cloud/speech')
61+
const client = new speech.SpeechClient()
6262
```
6363

6464
Add your keyword and initialize Sonus with a [Snowboy](https://snowboy.kitt.ai)
6565
hotword:
6666
``` javascript
6767
const hotwords = [{ file: 'resources/snowboy.umdl', hotword: 'snowboy' }]
68-
const sonus = Sonus.init({ hotwords }, speech)
68+
const sonus = Sonus.init({ hotwords }, client)
6969
```
7070

7171
Create your own Alexa in less than a tweet:

examples/annyang-example.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
const ROOT_DIR = __dirname + '/../'
44
const Sonus = require(ROOT_DIR + 'index.js')
5-
const speech = require('@google-cloud/speech')({
5+
const speech = require('@google-cloud/speech')
6+
const client = new speech.SpeechClient({
67
projectId: 'streaming-speech-sample',
7-
keyFilename: ROOT_DIR + 'keyfile.json'
8+
keyFilename: ROOT_DIR + 'keyfile.json'
89
})
910

1011
const hotwords = [{ file: ROOT_DIR + 'resources/sonus.pmdl', hotword: 'sonus' }]
1112
const language = "en-US"
12-
const sonus = Sonus.init({ hotwords, language: language }, speech)
13+
const sonus = Sonus.init({ hotwords, language: language }, client)
1314

1415
const commands = {
1516
'hello': function () {

examples/example.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
'use strict'
22

33
const ROOT_DIR = __dirname + '/../'
4-
const Sonus = require(ROOT_DIR + 'index.js')
5-
const speech = require('@google-cloud/speech')({
4+
const Sonus = require(ROOT_DIR + 'index.js') //require('sonus')
5+
const speech = require('@google-cloud/speech')
6+
const client = new speech.SpeechClient({
67
projectId: 'streaming-speech-sample',
7-
keyFilename: ROOT_DIR + 'keyfile.json'
8+
keyFilename: ROOT_DIR + 'keyfile.json'
89
})
910

1011
const hotwords = [{ file: ROOT_DIR + 'resources/sonus.pmdl', hotword: 'sonus' }]
1112
const language = "en-US"
1213

1314
//recordProgram can also be 'arecord' which works much better on the Pi and low power devices
14-
const sonus = Sonus.init({ hotwords, language: language, recordProgram: "rec" }, speech)
15+
const sonus = Sonus.init({ hotwords, language: language, recordProgram: "rec" }, client)
1516

1617
Sonus.start(sonus)
1718
console.log('Say "' + hotwords[0].hotword + '"...')

examples/trigger-example.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
const ROOT_DIR = __dirname + '/../'
44
const Sonus = require(ROOT_DIR + 'index.js')
5-
const speech = require('@google-cloud/speech')({
5+
const speech = require('@google-cloud/speech')
6+
const client = new speech.SpeechClient({
67
projectId: 'streaming-speech-sample',
7-
keyFilename: ROOT_DIR + 'keyfile.json'
8+
keyFilename: ROOT_DIR + 'keyfile.json'
89
})
910

1011
const hotwords = [{ file: ROOT_DIR + 'resources/sonus.pmdl', hotword: 'sonus' }]
1112
const language = "en-US"
12-
const sonus = Sonus.init({ hotwords, language: language }, speech)
13+
const sonus = Sonus.init({ hotwords, language: language }, client)
1314

1415
try{
1516
Sonus.trigger(sonus, 1)

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sonus",
3-
"version": "0.1.9",
3+
"version": "0.2.0-rc1",
44
"description": "Open source cross platform decentralized always-on speech recognition framework",
55
"main": "index.js",
66
"scripts": {
@@ -26,8 +26,8 @@
2626
},
2727
"homepage": "https://github.com/evancohen/sonus#readme",
2828
"dependencies": {
29-
"@google-cloud/speech": "^0.10.3",
30-
"node-record-lpcm16": "^0.3.0",
29+
"@google-cloud/speech": "^2.1.1",
30+
"node-record-lpcm16": "^0.3.1",
3131
"snowboy": "^1.2.0"
3232
},
3333
"devDependencies": {

0 commit comments

Comments
 (0)