All Projects → RedKenrok → node-audiorecorder

RedKenrok / node-audiorecorder

Licence: MIT License
Audio recorder for Node.js, delivers a 16-bit signed-integer linear pulse modulation WAV stream.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-audiorecorder

vaporiser
🎵 Creates a vaporwave (slowed, with reverb) remix of a given MP3 file, with the option of playing over a looped GIF as a video.
Stars: ✭ 14 (-79.41%)
Mutual labels:  sox
tsunami
A simple but powerful audio editor
Stars: ✭ 41 (-39.71%)
Mutual labels:  audio-recording
ear-pipe
Pipe audio streams to your ears
Stars: ✭ 17 (-75%)
Mutual labels:  sox
php-bpm-detect
php class for bpm detection
Stars: ✭ 22 (-67.65%)
Mutual labels:  sox
vim-rec
GNU Recutils syntax highlighting support for Vim
Stars: ✭ 30 (-55.88%)
Mutual labels:  rec
sox.js
📢 NodeJS wrapper for the SoX audio tool
Stars: ✭ 18 (-73.53%)
Mutual labels:  sox
sox-stream
📣 A stream-friendly wrapper around SoX
Stars: ✭ 50 (-26.47%)
Mutual labels:  sox
react-native-recording
React Native audio recording module used for DSP with Android + iOS
Stars: ✭ 86 (+26.47%)
Mutual labels:  audio-recording
SoxSharp
.NET wrapper for SoX.
Stars: ✭ 41 (-39.71%)
Mutual labels:  sox
castty
A CLI tool to record audio-enabled screencasts of your terminal, for the web.
Stars: ✭ 109 (+60.29%)
Mutual labels:  audio-recording

npm package @latest Travis-ci status

License agreement Open issues on GitHub

Audio recorder

Audio recorder for Node.js, delivers a 16-bit signed-integer linear pulse modulation WAV stream. Based of Gilles De Mey's node-record-lpcm16.

Installation

npm install --save node-audiorecorder

Dependencies

This module requires you to install SoX and it must be available in your $PATH.

For Linux

sudo apt-get install sox libsox-fmt-all

For MacOS

brew install sox

For Windows

Download the binaries

Usage

Constructor

// Import module.
const AudioRecorder = require('node-audiorecorder');

// Options is an optional parameter for the constructor call.
// If an option is not given the default value, as seen below, will be used.
const options = {
  program: `rec`,     // Which program to use, either `arecord`, `rec`, or `sox`.
  device: null,       // Recording device to use, e.g. `hw:1,0`

  bits: 16,           // Sample size. (only for `rec` and `sox`)
  channels: 1,        // Channel count.
  encoding: `signed-integer`,  // Encoding type. (only for `rec` and `sox`)
  format: `S16_LE`,   // Encoding type. (only for `arecord`)
  rate: 16000,        // Sample rate.
  type: `wav`,        // Format type.

  // Following options only available when using `rec` or `sox`.
  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.
const logger = console;

// Create an instance.
let audioRecorder = new AudioRecorder(options, logger);

If you can't capture any sound with 'arecord' try to running 'arecord -l' to which devices are available.

See the arecord documentation for more detail on its options.

See the sox documentation for more detail on the rec and sox options.

Methods

// Creates and starts the recording process.
audioRecorder.start();
// Stops and removes the recording process.
audioRecorder.stop();
// Returns the stream of the recording process.
audioRecorder.stream();

Examples

See the examples directory for example usage.

For another example see the node-hotworddetector module, or Electron-VoiceInterfaceBoilerplate's input.js.

Troubleshooting

Windows continues recording

If you have issues with continues recording on Windows 10 with SoX 14.4.2 or later, install version 14.4.1 instead.

License

MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].