diff --git a/README.md b/README.md index 87aaf53..33c622a 100644 --- a/README.md +++ b/README.md @@ -52,20 +52,20 @@ brew install sox Configure out cloud speech recognition system of choice, like [Google Cloud Speech API](https://cloud.google.com/speech/docs/getting-started). +__Note:__ You need to use the `GOOGLE_APPLICATION_CREDENTIALS` environment variable for your JSON keyfile. + Add sonus and said recognizer: ``` javascript const Sonus = require('sonus') -const speech = require('@google-cloud/speech')({ - projectId: 'streaming-speech-sample', - keyFilename: './keyfile.json' -}) +const speech = require('@google-cloud/speech') +const client = new speech.SpeechClient() ``` Add your keyword and initialize Sonus with a [Snowboy](https://snowboy.kitt.ai) hotword: ``` javascript const hotwords = [{ file: 'resources/snowboy.umdl', hotword: 'snowboy' }] -const sonus = Sonus.init({ hotwords }, speech) +const sonus = Sonus.init({ hotwords }, client) ``` Create your own Alexa in less than a tweet: diff --git a/examples/annyang-example.js b/examples/annyang-example.js index 9467cb9..3d51d6a 100644 --- a/examples/annyang-example.js +++ b/examples/annyang-example.js @@ -2,14 +2,15 @@ const ROOT_DIR = __dirname + '/../' const Sonus = require(ROOT_DIR + 'index.js') -const speech = require('@google-cloud/speech')({ +const speech = require('@google-cloud/speech') +const client = new speech.SpeechClient({ projectId: 'streaming-speech-sample', - keyFilename: ROOT_DIR + 'keyfile.json' + keyFilename: ROOT_DIR + 'keyfile.json' }) const hotwords = [{ file: ROOT_DIR + 'resources/sonus.pmdl', hotword: 'sonus' }] const language = "en-US" -const sonus = Sonus.init({ hotwords, language: language }, speech) +const sonus = Sonus.init({ hotwords, language: language }, client) const commands = { 'hello': function () { diff --git a/examples/example.js b/examples/example.js index 2182115..bfa3fae 100644 --- a/examples/example.js +++ b/examples/example.js @@ -1,17 +1,18 @@ 'use strict' const ROOT_DIR = __dirname + '/../' -const Sonus = require(ROOT_DIR + 'index.js') -const speech = require('@google-cloud/speech')({ +const Sonus = require(ROOT_DIR + 'index.js') //require('sonus') +const speech = require('@google-cloud/speech') +const client = new speech.SpeechClient({ projectId: 'streaming-speech-sample', - keyFilename: ROOT_DIR + 'keyfile.json' + keyFilename: ROOT_DIR + 'keyfile.json' }) const hotwords = [{ file: ROOT_DIR + 'resources/sonus.pmdl', hotword: 'sonus' }] const language = "en-US" //recordProgram can also be 'arecord' which works much better on the Pi and low power devices -const sonus = Sonus.init({ hotwords, language: language, recordProgram: "rec" }, speech) +const sonus = Sonus.init({ hotwords, language: language, recordProgram: "rec" }, client) Sonus.start(sonus) console.log('Say "' + hotwords[0].hotword + '"...') diff --git a/examples/trigger-example.js b/examples/trigger-example.js index e8b9ef9..eab2a30 100644 --- a/examples/trigger-example.js +++ b/examples/trigger-example.js @@ -2,14 +2,15 @@ const ROOT_DIR = __dirname + '/../' const Sonus = require(ROOT_DIR + 'index.js') -const speech = require('@google-cloud/speech')({ +const speech = require('@google-cloud/speech') +const client = new speech.SpeechClient({ projectId: 'streaming-speech-sample', - keyFilename: ROOT_DIR + 'keyfile.json' + keyFilename: ROOT_DIR + 'keyfile.json' }) const hotwords = [{ file: ROOT_DIR + 'resources/sonus.pmdl', hotword: 'sonus' }] const language = "en-US" -const sonus = Sonus.init({ hotwords, language: language }, speech) +const sonus = Sonus.init({ hotwords, language: language }, client) try{ Sonus.trigger(sonus, 1) diff --git a/package.json b/package.json index 82b9294..c254132 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sonus", - "version": "0.1.9", + "version": "0.2.0-rc1", "description": "Open source cross platform decentralized always-on speech recognition framework", "main": "index.js", "scripts": { @@ -26,8 +26,8 @@ }, "homepage": "https://github.com/evancohen/sonus#readme", "dependencies": { - "@google-cloud/speech": "^0.10.3", - "node-record-lpcm16": "^0.3.0", + "@google-cloud/speech": "^2.1.1", + "node-record-lpcm16": "^0.3.1", "snowboy": "^1.2.0" }, "devDependencies": {