README
decodeAudioData
Usage
const { decodeAudioData } = require("decode-audio-data");
decodeAudioData(
fs.readFileSync("music.mp3")
);
// return: Promise<AudioBuffer>
const { decodeAudioDataStream } = require("decode-audio-data");
decodeAudioDataStream(
fs.createReadStream("music.mp3")
);
// return: ReadableStream<Buffer>
decodeAudioData(input[, options])
Parameters
input<Buffer> | <Uint8Array> | <Readable>
A Buffer containing the audio data to be decoded
(optional) options<Object>
Options for decoding
options.numberOfChannels<number>
An integer representing the number of channels this buffer should have. The default value is 2
options.sampleRate<number>
The sample rate of the linear audio data in sample-frames per second. The default value is 48000
Return value
< decodedDataPromise<AudioBuffer>>
A Promise object that fulfills with the decoded aduio data
decodeAudioDataStream(stream[, options])
Parameters
stream<Readable>
A Readable stream containing the audio data to be decoded
(optional) options<Object>
Options for decoding
options.numberOfChannels<number>
An integer representing the number of channels this buffer should have. The default value is 1
options.sampleRate<number>
The sample rate of the linear audio data in sample-frames per second. The default value is 48000
Return value
< decodedDataReadable<Buffer>>
A Readable stream containing decoded audio data