wav-web-audio-recorder

0.2.1 • Public • Published

wav-web-audio-recorder

This is a fork of @gkt/microphone with different default configs and promises as returns

only records in mono and does not downsample.

@gkt/microphone is a JavaScript library for recording audio via the WebAudio API.

Installation

$ yarn add wav-web-audio-recorder

or

$ npm install wav-web-audio-recorder

Usage

import Recorder from "wav-web-audio-recorder";
 
navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
  const recorder = new Recorder(stream);
 
  // start recording audio from the microphone
  recorder
    .start()
    .then(() => {
      //do something
    })
    .catch((error) => {
      //do something
    });
 
  // periodically export a Blob containing WAV data of the audio recorded since the last export
  recorder
    .export()
    .then((blob) => {
      // do something
    })
    .catch((error) => {
      // do something
    });
 
  // stop recording audio
  recorder
    .stop()
    .then(() => {
      //do something
    })
    .catch((error) => {
      //do something
    });
});

Publishing

To publish a new version, update the version field in the package.json file and run:

$ npm publish --access public

This will automatically apply a git tag matching the version and push it.

Readme

Keywords

none

Package Sidebar

Install

npm i wav-web-audio-recorder

Weekly Downloads

17

Version

0.2.1

License

Apache-2.0

Unpacked Size

38.4 kB

Total Files

7

Last publish

Collaborators

  • hmontazeri