evancohen / sonus

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

Sonus.pause() #23

Closed DeusRa closed 7 years ago

DeusRa commented 7 years ago

Hello,

when running sonus I get the following error:

Say "alexa"... !alexa Partial test Final test /home/pi/NodeJS/node_modules/sonus/index.js:118 Sonus.pause = sonus => sonus.mic.pause() ^

TypeError: Cannot read property 'mic' of undefined at Object.CloudSpeechRecognizer.init.CloudSpeechRecognizer.startStreaming.recognitionStream.on.Sonus.init.opts.hotwords.forEach.detector.on.csr.on.Sonus.start.Sonus.pause.sonus [as pause] (/home/pi/NodeJS/node_modules/sonus/index.js:118:29) at Writable. (/home/pi/NodeJS/VIKI/sonus.js:29:9) at emitOne (events.js:77:13) at Writable.emit (events.js:169:7) at Writable. (/home/pi/NodeJS/node_modules/sonus/index.js:98:15) at emitOne (events.js:77:13) at Writable.emit (events.js:169:7) at null. (/home/pi/NodeJS/node_modules/sonus/index.js:42:29) at emitOne (events.js:77:13) at emit (events.js:169:7)

I´m running this on my Raspberry Pi 2 (Model B). My node version is 4.6.2. I took the code from examples. Is this a bug oder am I missing something? (my sonus.js is only placed somewhere else and I added absolute path to /node_modules/sonus/index.js path entries.

Greetings Nycon

evancohen commented 7 years ago

You have to pass the sonus object when pausing.

Sonus.pause(sonus)