Skip to main content

novelty_curve

Function novelty_curve 

Source
pub fn novelty_curve(
    ssm: &[f32],
    n_frames: usize,
    kernel_size: usize,
    out: &mut [f32],
) -> Result<(), AudioError>
Expand description

Correlate a checkerboard kernel along the diagonal of ssm, producing a per-frame novelty curve.

ssm is a row-major n_frames × n_frames self-similarity matrix (as produced by super::ssm::self_similarity). kernel_size is the full width L of the (L × L) checkerboard kernel and must be even and ≥ 2; each half-quadrant then spans M = L/2 frames.

The novelty at frame n is Σ_{a,b} C(a,b) · S[n+a, n+b] over kernel offsets a, b ∈ [-M, M), where the checkerboard sign is +1 when a and b lie on the same side of the split and -1 otherwise. The diagonal is centred at (n, n). Kernel taps that fall outside [0, n_frames) are treated as zero (zero-padding), so a full-length curve of n_frames values is produced.

§Caller-buffer contract (zero-heap)

The n_frames-long result is written into the caller-provided out; out.len() must be at least n_frames. No heap allocation is performed.

§Errors