@@ -12,6 +12,10 @@ High-quality, streaming-friendly STFT/iSTFT implementation in Rust working with
1212- ** Batch Processing** : Process entire audio buffers at once
1313- ** Streaming Support** : Incremental processing for real-time applications
1414- ** High Quality** : >138 dB SNR reconstruction
15+ - ** no_std Support** : Run on embedded systems without the standard library! 🚀
16+ - ** Dual FFT Backends** : Choose the right backend for your environment
17+ - ` rustfft ` (default): Full-featured for std environments, supports f32/f64 and any FFT size
18+ - ` microfft ` : Lightweight for no_std/embedded, f32 only, power-of-2 sizes up to 4096
1519- ** Dual Reconstruction Modes** :
1620 - ** OLA** (Overlap-Add): Optimal for spectral processing
1721 - ** WOLA** (Weighted Overlap-Add): Standard implementation
@@ -112,7 +116,7 @@ use stft_rs::prelude::*;
112116
113117This exports:
114118
115- - Core types: ` BatchStft ` , ` BatchIstft ` , ` StreamingStft ` , ` StreamingIstft ` , ` StftConfig ` , ` StftConfigBuilder ` , ` Spectrum ` , ` SpectrumFrame `
119+ - Core types: ` BatchStft ` , ` BatchIstft ` , ` StreamingStft ` , ` StreamingIstft ` , ` StftConfig ` , ` StftConfigBuilder ` , ` Spectrum ` , ` SpectrumFrame ` , ` Complex `
116120- Type aliases: ` StftConfigF32/F64 ` , ` StftConfigBuilderF32/F64 ` , ` BatchStftF32/F64 ` , ` BatchIstftF32/F64 ` , ` StreamingStftF32/F64 ` , ` StreamingIstftF32/F64 ` , ` SpectrumF32/F64 ` , ` SpectrumFrameF32/F64 `
117121- Mel types: ` MelConfig ` , ` MelSpectrum ` , ` BatchMelSpectrogram ` , ` StreamingMelSpectrogram ` , ` MelScale ` , ` MelNorm ` (+ F32/F64 aliases)
118122- Enums: ` ReconstructionMode ` , ` WindowType ` , ` PadMode `
@@ -404,10 +408,58 @@ let channels = deinterleave(&interleaved, 2);
404408let interleaved = interleave (& channels );
405409```
406410
407- Disable parallel processing: ` cargo build --no-default-features `
408-
409411See ` examples/multichannel_stereo.rs ` and ` examples/multichannel_midside.rs ` for more.
410412
413+ ## Embedded / no_std Support
414+
415+ stft-rs can run on embedded systems without the standard library! Perfect for audio processing on microcontrollers, DSPs, and bare-metal environments.
416+
417+ ### Using the microfft Backend for no_std
418+
419+ ``` toml
420+ [dependencies ]
421+ stft-rs = { version = " 0.5.0" , default-features = false , features = [" microfft-backend" ] }
422+ ```
423+
424+ ** Important notes:**
425+
426+ - microfft backend only supports f32 (not f64)
427+ - FFT sizes must be power-of-2 from 2 to 4096
428+ - Requires an allocator (uses ` alloc ` crate)
429+
430+ ### Example no_std Configuration
431+
432+ ``` rust
433+ #![no_std]
434+
435+ extern crate alloc;
436+ use alloc :: vec :: Vec ;
437+ use stft_rs :: prelude :: * ;
438+
439+ // Works great on embedded!
440+ let config = StftConfigF32 :: builder ()
441+ . fft_size (2048 ) // Must be power-of-2
442+ . hop_size (512 )
443+ . build ()
444+ . expect (" Valid config" );
445+
446+ let stft = BatchStftF32 :: new (config . clone ());
447+ let istft = BatchIstftF32 :: new (config );
448+
449+ let signal : Vec <f32 > = Vec :: from_slice (& audio_buffer );
450+ let spectrum = stft . process (& signal );
451+ let reconstructed = istft . process (& spectrum );
452+ ```
453+
454+ ### Feature Flags
455+
456+ - ` std ` (default): Standard library support with rustfft backend
457+ - ` rustfft-backend ` : Use rustfft for FFT (supports f32/f64, any size)
458+ - ` microfft-backend ` : Use microfft for no_std (f32 only, power-of-2 sizes)
459+ - ` rayon ` : Enable parallel multi-channel processing (requires std)
460+
461+ ** Note:** You cannot enable both ` rustfft-backend ` and ` microfft-backend ` at the same time.
462+
411463## Performance Characteristics
412464
413465- ** Batch Mode** : Optimized for throughput, minimal allocations
@@ -517,8 +569,18 @@ Tests verify:
517569
518570## Dependencies
519571
520- - ` rustfft ` : High-performance FFT implementation
521- - ` ndarray ` : Only for internal padding operations (minimal usage)
572+ Core dependencies:
573+
574+ - ` num-traits ` : Generic numeric traits (no_std compatible with ` libm ` )
575+
576+ FFT backends (mutually exclusive):
577+
578+ - ` rustfft ` (default): High-performance FFT for std environments
579+ - ` microfft ` (optional): Lightweight FFT for no_std/embedded
580+
581+ Optional dependencies:
582+
583+ - ` rayon ` : Parallel multi-channel processing (requires std)
522584
523585## License
524586
0 commit comments