Streaming STFT analysis + weighted overlap-add (WOLA) synthesis for DSP-grade spectral processing — distinct from the visualization-only Stft, which has no synthesis path. More...
#include <pulp/signal/checked_allocation.hpp>#include <pulp/signal/fft.hpp>#include <pulp/signal/windowing.hpp>#include <algorithm>#include <cassert>#include <complex>#include <cmath>#include <cstdint>#include <limits>#include <optional>#include <type_traits>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | pulp::signal::SpectralFrameEngineConfig |
| Configuration for a SpectralFrameEngine. More... | |
| struct | pulp::signal::SpectralFrameEngineGeometry |
| class | pulp::signal::SpectralFrameEngineT< SampleType > |
| Streaming multichannel STFT/WOLA engine. More... | |
Namespaces | |
| namespace | pulp |
| namespace | pulp::signal |
Typedefs | |
| using | pulp::signal::SpectralFrameEngine = SpectralFrameEngineT<float> |
| using | pulp::signal::SpectralFrameEngine64 = SpectralFrameEngineT<double> |
Functions | |
| bool | pulp::signal::is_valid_spectral_frame_geometry (int fft_size, int analysis_hop) noexcept |
| constexpr std::int64_t | pulp::signal::spectral_frame_engine_first_frame_start (int fft_size, int analysis_hop, bool full_overlap_stream_start) noexcept |
| Stream position of the first analysis frame after prepare()/reset(). | |
| template<typename SampleType> | |
| double | pulp::signal::spectral_ola_window_energy (const SampleType *window, int fft_size, int hop, std::int64_t first_frame_start, std::int64_t position) noexcept |
| Accumulated squared synthesis window at stream position for equal-hop frames of length fft_size starting at first_frame_start + k * hop (k >= 0) — the per-sample divisor the WOLA path normalizes by. | |
| template<typename SampleType> | |
| std::optional< SpectralFrameEngineGeometry > | pulp::signal::checked_spectral_frame_engine_geometry (const SpectralFrameEngineConfig &config, std::uint64_t target_max_bytes=kTargetAddressMaximumBytes) noexcept |
| Derive every integer and typed backing-store capacity used by prepare(). | |
Variables | |
| constexpr int | pulp::signal::kSpectralFrameEngineMinimumFftSize = 256 |
| constexpr int | pulp::signal::kSpectralFrameEngineMaximumFftSize = 16384 |
| constexpr std::uint64_t | pulp::signal::kSpectralFrameEngineMaximumRingSize |
Streaming STFT analysis + weighted overlap-add (WOLA) synthesis for DSP-grade spectral processing — distinct from the visualization-only Stft, which has no synthesis path.
Channels are processed as a coherent group: every analysis callback delivers all channels' spectra for the same time index, so spectral modifications (pitch/time, formant, freeze) can make one decision per frame and apply it to the whole group.
Two usage levels:
Reconstruction is normalized per-sample by the accumulated squared synthesis window, which keeps amplitude exact for any hop (including variable hops and stream edges) without hardcoded COLA constants.
Stream start: by default the frame grid begins before the first input sample (at first_frame_start(), the last hop multiple above -fft_size), with silence as the implicit history. Every real sample, including sample 0 after prepare() or reset(), is therefore covered by the full set of overlapping windows and reconstructs exactly; the pre-stream part of those frames is discarded, and the reported latency is unchanged. Callers need not prime the engine with silence; doing so is harmless but runs the FFTs of the primed frames.
Basis: Allen & Rabiner 1977 (unified STFT analysis/synthesis); Crochiere 1980 (weighted overlap-add). No allocation or locks after prepare().