Changelog
version 10.3.0 - 2020-01-20
New resample methods: linear for linear interpolation and point for nearest point interpolation. Both methods use no LPF by default; others methods use LPF by default.
Resample with or without LPF using any interpolation method:
// Resample using cubic without LPF
wav.toSampleRate(44100, {method: 'cubic', LPF: false});
// Resample using cubic with LPF:
wav.toSampleRate(44100, {method: 'cubic', LPF: true});
// cubic and sinc use LPF by default
wav.toSampleRate(44100, {method: 'cubic'}); // will use LPF
getSamples()
:// Will return the samples de-interleaved,
// packed in a array of Int32Array objects, one for each channel
samples = wav.getSamples(false, Int32Array);
// will return the samples de-interleaved,
// packed in a array of Int16Array objects, one for each channel
let samples = getSamples(false, Int16Array);
// will return the samples interleaved, packed in a Int16Array
let samples = getSamples(true, Int16Array);
Changelog
version 10.2.0 - 2020-01-16
Change the sample rate.
Change the sample rate with wav.toSampleRate();
Changelog
version 10.1.0 - 2020-01-08
Add getSamples() to the API. It returns the samples packed in a Float64Array. If the file have more than one channel, samples will be returned de-interleaved in a Array of Float64Array objects, one for each channel. The method takes a optional boolean param interleaved, set to false by default. If set to true, samples will be returned interleaved. Default is de-interleaved.
// Both will return de-interleaved samples
samples = wav.getSamples();
samples = wav.getSamples(false);
// To get interleaved samples
samples = wav.getSamples(true);