This package converts interleaved floating-point PCM without changing thedeclared playback sample rate. rate is input frames advanced per outputframe: a value of 2 doubles pitch and halves duration. Supported rates are0.25 through 4, with 1 through 8 channels.
new(channels, rate) creates the converter. Feed complete frames to push,consume the returned output, then append the result of finish. No host I/O,native DSP library, or SoundTouch implementation is used. reset reuses theconfigured filter for an independent stream.
For non-identity rates, the kernel is a normalized Blackman-windowed sinc.Its normalized cutoff is 0.9 / max(1, rate) and its input-frame radius isceil(48 * max(1, rate)). A table of 513 phases is built once; runtime samplesinterpolate between adjacent coefficient rows. Downsampling lowers the cutoffand increases the support rather than aliasing high frequencies through afixed interpolation filter. All channels use the same fractional position.
The filter intentionally reserves a transition band below Nyquist; it is nota brick-wall filter. Lookahead is exposed by latency_frames. Output beginswhen the first center has its complete future support. finish extends thefirst and last samples, preserves DC at the edges, and emits exactlyfloor(input_frames / rate + 0.5) frames. Identity conversion is an immediate,bit-exact copy, including signed zero. The retained history after a push isbounded by twice the filter radius plus four frames; input and returned outputarrays remain the caller's responsibility.
The tests measure passband waveform error, at least 60 dB stopband rejectionfor specified 1.37x, 2x and 4x downsampling tones, impulse timing, reportedlookahead, endpoint DC, signed-zero identity, invalid-input atomicity, finalduration, per-channel isolation, and exact input-partition invariance. Theseare numerical checks of this rate converter, not perceptual quality claims forthe complete time-stretch pipeline.
Algorithm background: Julius O. Smith III,Windowed Sinc Interpolation.The implementation in this repository is original; no source code is copiedfrom that reference or from SoundTouch.