Class: MediaElementAudioStream

MediaElementAudioStream

new MediaElementAudioStream(source, optsopt)

Turns a MediaStream object (from getUserMedia) into a Node.js Readable stream and converts the audio to Buffers
Parameters:
Name Type Attributes Description
source MediaStream | HTMLMediaElement either https://developer.mozilla.org/en-US/docs/Web/API/MediaStream or https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement
opts Object <optional>
options
Properties
Name Type Attributes Default Description
bufferSize Number | null <optional>
null https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createScriptProcessor
muteSource Boolean <optional>
false If true, the audio will not be sent back to the source // todo: add option for whether to keep or destroy the context
Source:
See:

Methods

(static) toRaw(chunk) → {Float32Array}

Converts a Buffer back into the raw Float32Array format that browsers use. Note: this is just a new DataView for the same underlying buffer - the actual audio data is not copied or changed here.
Parameters:
Name Type Description
chunk Buffer node-style buffer of audio data from a 'data' event or read() call
Source:
Returns:
raw 32-bit float data view of audio data
Type
Float32Array

(inner) connect()

Setup script processor to extract audio and also re-connect it via a no-op gain node if desired Delayed to avoid processing the stream of silence received before the file begins playing
Source:

(inner) processAudio(e)

Convert and emit the raw audio data
Parameters:
Name Type Description
e AudioProcessingEvent https://developer.mozilla.org/en-US/docs/Web/API/AudioProcessingEvent
Source:
See: