new MediaElementAudioStream(element, optionsopt)
Extracts audio from an <audio> or <video> element and provides it as a Node.js Readable stream
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
HTMLMediaElement | string |
|
|||||||||||||||||||||
options |
Object |
<optional> |
options Properties
|
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 |
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
(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 |