Skip to main content

//clika-runtime/io.clika.runtime/Ops/resample

resample

[common]
fun resample(input: Tensor, origFreq: Long, newFreq: Long, lowpassFilterWidth: Long = 16, rolloff: Double = 0.945, beta: Double? = null): Tensor

resample(input: Tensor, origFreq: Long, newFreq: Long, lowpassFilterWidth: Long = 16L, rolloff: Double = 0.945, beta: Double? = null): the resample operator. Audio-domain 1-D rational resample along the LAST axis: [.., S] at orig_freq → [.., ceil(S · L / M)] at new_freq, where L/M is the gcd-reduced rate pair. A kaiser-windowed-sinc polyphase FIR, the standard antialiased sample-rate converter; input outside the signal reads as zero, and equal rates pass the signal through exactly. Leading axes are batch/channels (transpose another samples axis to the back first, a view). The defaults are the kaiser preset: lowpass_filter_width sinc zero-crossings per side, rolloff of the target Nyquist, and (when beta is absent) the design beta 14.769656459379492 (~142.7 dB design stopband). Serves f32 natively and f16/bf16 through an f32 compute lane (output mirrors the input); integer and f64 signals refuse; cast to f32 first. CPU-served; device-resident inputs refuse until an accelerator kernel lands.