Changelog
version 11.0.0 - 2020-01-30
Changelog
version 10.4.0 - 2020-01-20
// Will use 'linear' method with a FIR LPF
wav.toSampleRate(44100, {method: "linear", LPF: true, LPFType: 'FIR'});
// Will use 'linear' method with a IIR LPF, the default
wav.toSampleRate(44100, {method: "linear", LPF: true});
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);
Changelog
version 10.0.0 - 2020-01-07
Better handling of cue points and regions.
[
{
position: 500, // the position in milliseconds
label: 'cue marker 1',
end: 1500, // the end position in milliseconds
dwName: 1,
dwPosition: 0,
fccChunk: 'data',
dwChunkStart: 0,
dwBlockStart: 0,
dwSampleOffset: 22050, // the position as a sample offset
dwSampleLength: 3646827, // the region length as a sample count
dwPurposeID: 544106354,
dwCountry: 0,
dwLanguage: 0,
dwDialect: 0,
dwCodePage: 0,
},
//...
];
// to create a cue point the position in milliseconds
// is the only required attribute
wav.setCuePoint({position: 1500});
// to create a cue point with a label
wav.setCuePoint({position: 1500, label: 'some label'});
// to create a cue region with a label:
wav.setCuePoint({position: 1500, end: 2500, label: 'some label'});
Objects that define regions can also define the following optional properties: