Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
stn_decomposer.hpp File Reference

Sines / Transients / Noise (STN) decomposition of a spectral frame stream by median-filter masking. More...

#include <pulp/signal/checked_allocation.hpp>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::signal::StnConfig
struct  pulp::signal::StnMasksT< SampleType >
 Per-frame soft masks. Each spans num_bins and sums to ~1 per bin. More...
class  pulp::signal::StnDecomposerT< SampleType >

Namespaces

namespace  pulp
namespace  pulp::signal

Typedefs

using pulp::signal::StnMasks = StnMasksT<float>
using pulp::signal::StnMasks64 = StnMasksT<double>
using pulp::signal::StnDecomposer = StnDecomposerT<float>
using pulp::signal::StnDecomposer64 = StnDecomposerT<double>

Detailed Description

Sines / Transients / Noise (STN) decomposition of a spectral frame stream by median-filter masking.

Tonal (sinusoidal) content forms horizontal ridges in a spectrogram (stable across time, narrow in frequency); transients form vertical ridges (broadband, brief in time); the rest is noise. Median-filtering the magnitude spectrogram along time emphasizes the tonal part, along frequency emphasizes the transient part, and soft masks derived from the two filtered versions partition each time-frequency bin into S, T, and N = 1 - S - T (Fitzgerald, "Harmonic/Percussive Separation using Median Filtering," DAFx 2010; STN extension and the soft-mask saturating function in Damskägg & Välimäki and Fierro & Välimäki; used as the front end of noise-morphing time-stretch in Moliner et al., "Noise Morphing for Audio Time Stretching," 2023).

The decomposition is the front end of a transparent stretcher: sines go through phase-vocoder time-scaling, transients are repositioned, and noise is re-synthesized by morphing (separate primitives). This class only produces the three soft masks (and optionally the split component magnitudes) for one frame at a time, keeping a short rolling history for the time-direction median.

Magnitude-domain, real-time-safe: a fixed history ring and per-frame median over odd windows; no allocation after prepare().