Change Bit Depth
Use toBitDepth(bitDepth) to change the bit depth of the samples. No dithering is performed.
Change Sample Rate
Use toSampleRate(sampleRate, options) to resample the audio.
Options:
method: The interpolation method. Options are:"point": Nearest point (fastest, lowest quality, no LPF)."linear": Linear interpolation (fast, low quality, no LPF)."cubic": Cubic interpolation (default, uses LPF by default)."sinc": Windowed sinc (slowest, highest quality, uses LPF by default).
LPF: Boolean to enable/disable the Low Pass Filter (default is true for cubic and sinc).LPFType: The type of LPF to use: "IIR" (default) or "FIR".
Note: To resample compressed files (ADPCM, mu-Law, A-Law), you must first convert them to PCM using their respective from...() methods.
// Change bit depth to 24-bit
wav.toBitDepth("24");
// Resample to 44.1kHz using sinc interpolation with no LPF
wav.toSampleRate(44100, {method: "sinc", LPF: false});
// Resample to 44.1kHz using linear interpolation with a FIR LPF
wav.toSampleRate(44100, {method: "linear", LPF: true, LPFType: 'FIR'});