New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

opus-recorder

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opus-recorder

A library for recording opus encoded audio

  • 0.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
decreased by-9.7%
Maintainers
1
Weekly downloads
 
Created
Source

Recorder.js

A library for recording/exporting the output of Web Audio API nodes encoded using libopus ver 1.1.1 beta compiled with emscripten.

Syntax

Constructor
var rec = new Recorder([config]);

Creates a recorder instance.

  • config - An optional configuration object (see config section below)

Config
  • bufferLength - (optional) The length of the buffer that the internal JavaScriptNode uses to capture the audio. Can be tweaked if experiencing performance issues. Defaults to 4096.
  • monitorGain - (optional) Sets the gain of the monitoring output. Gain is an a-weighted value between 0 and 1. Defaults to 0
  • numberOfChannels - (optional) The number of channels to record. 1 = mono, 2 = stereo. Defaults to 1. Maximum 2 channels are supported.
  • encoderSampleRate - (optional) Specifies the sample rate to encode at. Defaults to 48000. Supported values are 8000, 12000, 16000, 24000 or 48000.
  • workerPath - (optional) Path to oggopusEncoder.js worker script. Defaults to 'oggopusEncoder.js'
  • stream - (optional) Specifies wheather dataAvailable event should be fired when each page is ready. If true, requestData will have no effect. Defaults to false.
  • maxBuffersPerPage - (optional) Specifies the maximum number of buffers to use before generating an Ogg page. This can be used to lower the streaming latency. The lower the value the more overhead the ogg stream will incur. Defaults to 40.
  • encoderApplication - (optional) Specifies the encoder application. Supported values are 2048 - Voice, 2049 - Full Band Audio, 2051 - Restricted Low Delay. Defaults to 2049.
  • encoderFrameSize (optional) Specifies the frame size in ms used for encoding. Defaults to 20.
  • bitRate (optional) Specifies the target bitrate in bits/sec. The encoder selects an application-specific default when this is not specified.

Instance Methods
rec.addEventListener( type, listener[, useCapture] )

addEventListener will add an event listener to the event target. Available events are "duration", "streamError", "streamReady", "dataAvailable", "start", "pause", "resume" and "stop".

rec.initStream()

initStream will request the user for permission to access the the audio stream and raise "streamReady" or "streamError".

rec.pause()

pause will keep the stream and monitoring alive, but will not be recording the buffers. Will raise the pause event. Subsequent calls to resume will add to the current recording.

rec.removeEventListener( type, listener[, useCapture] )

removeEventListener will remove an event listener from the event target.

rec.resume()

resume will resume the recording if paused. Will raise the resume event

rec.setMonitorGain( gain )

setMonitorGain will set the volume on what will be passed to the monitor. Monitor level does not affect the recording volume. Gain is an a-weighted value between 0 and 1

rec.start()

start will initalize the worker and begin capturing audio if the audio stream is ready. Will raise the start event when started.

rec.stop()

stop will cease capturing audio and disable the monitoring and mic input stream. Will request the recorded data and then terminate the worker once the final data has been published. Will raise the stop event when stopped.


Static Methods
Recorder.isRecordingSupported()

Will return a boolean value indicating if the browser supports recording.

Keywords

FAQs

Package last updated on 13 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc