Skip to main content

cqt_spectrogram

Function cqt_spectrogram 

Source
pub fn cqt_spectrogram(
    signal: &[f32],
    sample_rate: f32,
    f_min: f32,
    bins_per_octave: usize,
    n_bins: usize,
    hop: usize,
    frame_len: usize,
    out: &mut [f32],
) -> Result<usize, AudioError>
Expand description

Compute a streaming CQT magnitude spectrogram over signal.

The window of length frame_len is advanced by hop samples per frame; for each frame the constant-Q magnitudes (n_bins bins, geometrically spaced from f_min at bins_per_octave) are computed with forward_cqt_mono and stored row-major into out as out[frame * n_bins + bin].

Returns the number of frames written. out must hold at least n_frames * n_bins values, where n_frames follows the hop math (1 + (signal.len() - frame_len) / hop, or 0 if the signal is too short).

ยงErrors