pub fn streaming_spectrogram(
signal: &[f64],
config: StreamingFftConfig,
) -> Vec<Vec<f64>>Expand description
Process an entire signal with the streaming API.
Pushes all samples through the processor and appends the flush output.
Returns all magnitude spectra (each of length fft_size / 2 + 1).
The number of output frames for a signal of length N with
N >= fft_size is floor((N - fft_size) / hop_size) + 1, plus at most
one more frame from the flush if there are remaining samples.
ยงExample
use scirs2_fft::streaming::{streaming_spectrogram, StreamingFftConfig, WindowType};
let signal: Vec<f64> = (0..512).map(|i| (i as f64 * 0.05).sin()).collect();
let config = StreamingFftConfig { fft_size: 64, hop_size: 32, window: WindowType::Hann };
let spectra = streaming_spectrogram(&signal, config);
assert!(!spectra.is_empty());
// Each spectrum has fft_size/2 + 1 = 33 bins.
assert_eq!(spectra[0].len(), 33);