Skip to content

Commit

Permalink
Add keepSilence option, release 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RedKenrok committed Dec 27, 2018
1 parent 205074a commit 3ccc75c
Show file tree
Hide file tree
Showing 5 changed files with 6,768 additions and 29 deletions.
40 changes: 22 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
# Changelog

## 1.4.0 (2018-12-27)
### Added
+ `keepSilence` option added fo `sox` and `rec` only. The option enables or disabled the `-l` flag which controls whether the silence is part of the recording or not.

## 1.3.0-beta.0 (2018-12-12)
### Added
- Opened up the `format` argument of the audio recorder options. (only for `arecord`)
+ Opened up the `format` argument of the audio recorder options. (only for `arecord`)
### Changed
- Fixed `arecord` command generation.
+ Fixed `arecord` command generation.

## 1.2.0 (2018-11-09)
### Changed
- Added `-l` to silence effect, therefore the silence not removed from the start of the recording.
- Default values of `thresholdStart` and `thresholdStop` are both set to `1`.
- Fixed duration of silence effect since duration parameters need to have a decimal. For example `2.0` instead of `2`.
+ Added `-l` to silence effect, therefore the silence not removed from the start of the recording.
+ Default values of `thresholdStart` and `thresholdStop` are both set to `1`.
+ Fixed duration of silence effect since duration parameters need to have a decimal. For example `2.0` instead of `2`.
### Removed
- `sampleRate` and `threshold` options removed.
+ `sampleRate` and `threshold` options removed.

## 1.1.6 (2018-11-08)
### Added
- Example added to examples directory, and changed `example.js` to `examples/print-command.js`.
+ Example added to examples directory, and changed `example.js` to `examples/print-command.js`.
### Fixed
- Fixed silence effect.
+ Fixed silence effect.

## 1.1.5 (2018-10-24)
### Added
- Added `bits`, `encoding`, `rate`, and `type` properties to options, which allows greater control over output.
+ Added `bits`, `encoding`, `rate`, and `type` properties to options, which allows greater control over output.
### Changed
- `sampleRate` option renamed to `rate`, legacy support still available.
+ `sampleRate` option renamed to `rate`, legacy support still available.

## 1.1.4 (2018-10-23)
### Added
- Tests added with continues integration and code coverage.
+ Tests added with continues integration and code coverage.
### Changed
- Clarified examples in `README.md`.
+ Clarified examples in `README.md`.
### Fixed
- `example.js` fixed.
- Default values fixed in `README.md`.
+ `example.js` fixed.
+ Default values fixed in `README.md`.

## 1.1.3 (2018-09-18)
### Added
- `CHANGELOG.md` added.
- `eslint` module added as dev dependency
- `.eslintrc.json` file added.
+ `CHANGELOG.md` added.
+ `eslint` module added as dev dependency
+ `.eslintrc.json` file added.
### Changed
- Restructured project files.
+ Restructured project files.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const options = {
silence: 2, // Duration of silence in seconds before it stops recording.
thresholdStart: 0.5, // Silence threshold to start recording.
thresholdStop: 0.5, // Silence threshold to stop recording.
keepSilence: true // Keep the silence in the recording.
};
// Optional parameter intended for debugging.
// The object has to implement a log and warn function.
Expand Down
18 changes: 14 additions & 4 deletions library/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AudioRecorder extends require(`events`).EventEmitter {
silence: 2, // Duration of silence in seconds before it stops recording.
thresholdStart: 0.5, // Silence threshold to start recording.
thresholdStop: 0.5, // Silence threshold to stop recording.
keepSilence: true // Keep the silence in the recording.
}, options);
this.logger = logger;

Expand Down Expand Up @@ -82,12 +83,21 @@ class AudioRecorder extends require(`events`).EventEmitter {
);

if (this.options.silence) {
// Stop recording after duration has passed below threshold.
this.command.arguments.push(
// Effect
`silence`,
// Keep silence in results
`-l`,
`silence`
);

// Keep the silence of the recording.
if (this.options.keepSilence) {
this.command.arguments.push(
// Keep silence in results
`-l`,
);
}

// Stop recording after duration has passed below threshold.
this.command.arguments.push(
// Enable above-periods
`1`,
// Duration
Expand Down
Loading

0 comments on commit 3ccc75c

Please sign in to comment.