Skip to content
This repository has been archived by the owner on Jun 26, 2019. It is now read-only.

Audio recorder for Node.js. This fork focuses only on arecord.

License

Notifications You must be signed in to change notification settings

jrnelson90/node-arecord

 
 

Repository files navigation

Arecord For Node

Audio recorder for Node.js, Based of RedKenrok's node-audiorecorder.

Installation

npm install --save node-arecord

Usage

Constructor

// Import module.
const Arecord = require('node-arecord');

// 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 = {
  device: null,       // Recording device to use.
  channels: 2,        // Channel count.
  format: `S16_LE`,   // Encoding type. (only for `arecord`)
  rate: 48000,        // Sample rate.
  type: `wav`,        // Format type.
};
// Optional parameter intended for debugging.
// The object has to implement a log and warn function.
const logger = console;

// Create an instance.
let audioIn = new Arecord(options, logger);

'arecord' will only work for linux based systems. If you can't capture any sound with 'arecord', try to change device to 'arecord -l'.

See the arecord documentation for more detail on its options.

Methods

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

Examples

See the examples directory for example usage.

License

MIT license

About

Audio recorder for Node.js. This fork focuses only on arecord.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%