From cff55566f458a39fd3ca3dff46a5782175afd25f Mon Sep 17 00:00:00 2001 From: Ron Dekker Date: Thu, 8 Nov 2018 11:49:47 +0100 Subject: [PATCH] Fixed silence option --- examples/print-command.js | 3 +-- library/index.js | 12 ++++++------ package-lock.json | 2 +- package.json | 2 +- test/options.js | 4 ++-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/examples/print-command.js b/examples/print-command.js index 7ee795c..d8509b8 100644 --- a/examples/print-command.js +++ b/examples/print-command.js @@ -3,6 +3,5 @@ const AudioRecorder = require(`../library`); // Initialize recorder. new AudioRecorder({ - program: process.platform === `win32` ? `sox` : `rec`, - silence: 0 + program: process.platform === `win32` ? `sox` : `rec` }, console); \ No newline at end of file diff --git a/library/index.js b/library/index.js index d3c2604..a19fc22 100644 --- a/library/index.js +++ b/library/index.js @@ -81,7 +81,9 @@ class AudioRecorder extends require(`events`).EventEmitter { // Add sample size and encoding type. this.command.arguments.push( `-b`, this.options.bits.toString(), - `-e`, this.options.encoding + `-e`, this.options.encoding, + // Pipe + `-` ); // End on silence @@ -95,17 +97,15 @@ class AudioRecorder extends require(`events`).EventEmitter { case `arecord`: this.command.arguments.push( // Sample format - `-f`, `S16_LE` + `-f`, `S16_LE`, + // Pipe + `-` ); if (this.options.device) { this.command.arguments.push(`-D`, this.options.device); } break; } - this.command.arguments.push( - // Pipe - `-` - ); if (this.logger) { // Log command. diff --git a/package-lock.json b/package-lock.json index c176e03..2230f31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "node-audiorecorder", - "version": "1.1.5", + "version": "1.1.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a4b7abe..83a76f2 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "url": "https://rondekker.nl" }, "name": "node-audiorecorder", - "version": "1.1.5", + "version": "1.1.6", "description": "Record audio via node using a SOX.", "license": "MIT", "keywords": [ diff --git a/test/options.js b/test/options.js index b12738a..658936f 100644 --- a/test/options.js +++ b/test/options.js @@ -21,14 +21,14 @@ test(`default`, function(t) { `16`, `-e`, `signed-integer`, + `-`, `silence`, `1`, `0.1`, `0.5%`, `1`, `2`, - `0.5%`, - `-` + `0.5%` ]); t.deepEqual(audioRecorder.command.options, { encoding: `binary`