+1
-1
| language: node_js | ||
| node_js: | ||
| - "--lts" | ||
| - "8" | ||
@@ -5,0 +5,0 @@ before_install: |
+39
-2
@@ -12,2 +12,4 @@ 'use strict' | ||
| const ARECORD_FILE_LIMIT = 1500000000 // 1.5 GB | ||
| const CloudSpeechRecognizer = {} | ||
@@ -151,3 +153,14 @@ CloudSpeechRecognizer.init = recognizer => { | ||
| Sonus.start = sonus => { | ||
| sonus.mic = record.start({ | ||
| sonus.mic = Recorder(sonus) | ||
| if(sonus.recordProgram === "arecord"){ | ||
| ArecordHelper.init(sonus) | ||
| } | ||
| sonus.mic.pipe(sonus.detector) | ||
| sonus.started = true | ||
| } | ||
| const Recorder = (sonus) => { | ||
| return record.start({ | ||
| threshold: 0, | ||
@@ -158,5 +171,29 @@ device: sonus.device || null, | ||
| }) | ||
| } | ||
| const ArecordHelper = {byteCount: 0} | ||
| ArecordHelper.init = (sonus) => { | ||
| ArecordHelper.track(sonus) | ||
| } | ||
| ArecordHelper.track = (sonus) => { | ||
| sonus.mic.on('data', data => { | ||
| ArecordHelper.byteCount += data.length | ||
| // When we get to arecord wav file limit, reset | ||
| if(ArecordHelper.byteCount > ARECORD_FILE_LIMIT){ | ||
| ArecordHelper.restart(sonus) | ||
| } | ||
| }) | ||
| } | ||
| ArecordHelper.restart = (sonus) => { | ||
| sonus.mic.unpipe(sonus.detector) | ||
| record.stop() | ||
| // Restart the audio recording | ||
| sonus.mic = Recorder(sonus) | ||
| ArecordHelper.byteCount = 0 | ||
| ArecordHelper.track(sonus) | ||
| sonus.mic.pipe(sonus.detector) | ||
| sonus.started = true | ||
| } | ||
@@ -163,0 +200,0 @@ |
+1
-1
| { | ||
| "name": "sonus", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1-beta.1", | ||
| "description": "Open source cross platform decentralized always-on speech recognition framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
1418140
0.06%442
7.02%1
Infinity%