Expand description
§Veils: High-Performance STFT Library
Veils provides a high-performance Short-Time Fourier Transform (STFT) implementation
compatible with the one-dimensional, real-valued subset of
scipy.signal.ShortTimeFFT documented in the project README.
§Features
- SciPy compatibility: Verified against SciPy 1.18.1
- High performance: Optimized Rust implementation using rustfft
- Multiple FFT modes: TwoSided, Centered, OneSided, OneSided2X
- Invertible STFT: Perfect reconstruction with canonical dual window
- Flexible windowing: Support for custom windows and dual windows
§Quick Start
use veils::StandaloneSTFT;
// Create a Hann window
let window: Vec<f64> = (0..16)
.map(|i| 0.5 * (1.0 - (2.0 * std::f64::consts::PI * i as f64 / 15.0).cos()))
.collect();
// Create STFT instance
let stft = StandaloneSTFT::new(
window,
4, // hop length
1000.0, // sampling rate
Some("onesided"),
None, // mfft (defaults to window length)
None, // dual_win (computed automatically)
None, // phase_shift
).unwrap();
// Generate test signal
let signal: Vec<f64> = (0..64)
.map(|i| (2.0 * std::f64::consts::PI * 5.0 * i as f64 / 1000.0).sin())
.collect();
// Compute STFT
let stft_result = stft.stft(&signal, None, None, None).unwrap();
println!("STFT shape: {} x {}", stft_result.len(), stft_result[0].len());Structs§
- StandaloneSTFT
- Short-Time Fourier Transform implementation
Enums§
- FftMode
- FFT mode for STFT computation