Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::NoiseMorpherT< SampleType > Class Template Reference

RT contract: prepare() and prepare_masked_scratch() allocate storage and must run off the audio thread. More...

#include <noise_morpher.hpp>

Public Member Functions

void prepare (int num_bins, std::uint64_t seed=0x9e3779b97f4a7c15ull)
int num_bins () const
void reset ()
void push_envelope (const SampleType *noise_mag)
 Set the noise magnitude envelope for the current analysis frame.
void advance ()
 Commit the current "to" envelope as the next "from" endpoint.
void set_synthesis_gain (SampleType g)
 Emit one synthesis frame at interpolation position frac in [0,1] between the previous and current envelopes (frac=0 → previous, frac=1 → current).
void synthesize (SampleType frac, std::complex< SampleType > *out)
void push_masked_envelope (const SampleType *full_mag, const SampleType *noise_mask)
 Convenience: pull the noise component out of a full magnitude frame using an STN noise mask, then push it as the envelope.
void prepare_masked_scratch ()

Static Public Member Functions

static bool checked_retained_bytes (int num_bins, std::uint64_t target_max_bytes, std::uint64_t &bytes) noexcept

Detailed Description

template<typename SampleType = float>
class pulp::signal::NoiseMorpherT< SampleType >

RT contract: prepare() and prepare_masked_scratch() allocate storage and must run off the audio thread.

After preparation, reset(), push_envelope(), advance(), synthesize(), and push_masked_envelope() allocate no memory for the prepared bin count.

Member Function Documentation

◆ advance()

template<typename SampleType = float>
void pulp::signal::NoiseMorpherT< SampleType >::advance ( )
inline

Commit the current "to" envelope as the next "from" endpoint.

Call once per analysis frame after emitting that frame's synthesis output (so interpolation walks from frame to frame).

◆ checked_retained_bytes()

template<typename SampleType = float>
bool pulp::signal::NoiseMorpherT< SampleType >::checked_retained_bytes ( int num_bins,
std::uint64_t target_max_bytes,
std::uint64_t & bytes )
inlinestaticnoexcept

◆ num_bins()

template<typename SampleType = float>
int pulp::signal::NoiseMorpherT< SampleType >::num_bins ( ) const
inline

◆ prepare()

template<typename SampleType = float>
void pulp::signal::NoiseMorpherT< SampleType >::prepare ( int num_bins,
std::uint64_t seed = 0x9e3779b97f4a7c15ull )
inline

◆ prepare_masked_scratch()

template<typename SampleType = float>
void pulp::signal::NoiseMorpherT< SampleType >::prepare_masked_scratch ( )
inline

◆ push_envelope()

template<typename SampleType = float>
void pulp::signal::NoiseMorpherT< SampleType >::push_envelope ( const SampleType * noise_mag)
inline

Set the noise magnitude envelope for the current analysis frame.

Successive calls advance the interpolation window: the previous envelope becomes the "from" endpoint and this one the "to".

◆ push_masked_envelope()

template<typename SampleType = float>
void pulp::signal::NoiseMorpherT< SampleType >::push_masked_envelope ( const SampleType * full_mag,
const SampleType * noise_mask )
inline

Convenience: pull the noise component out of a full magnitude frame using an STN noise mask, then push it as the envelope.

◆ reset()

template<typename SampleType = float>
void pulp::signal::NoiseMorpherT< SampleType >::reset ( )
inline

◆ set_synthesis_gain()

template<typename SampleType = float>
void pulp::signal::NoiseMorpherT< SampleType >::set_synthesis_gain ( SampleType g)
inline

Emit one synthesis frame at interpolation position frac in [0,1] between the previous and current envelopes (frac=0 → previous, frac=1 → current).

out holds num_bins complex bins (DC..Nyquist) with magnitude = interpolated envelope and fresh random phase. Compensate the random-phase WOLA energy loss. Random-phase synthesis frames overlap-add INCOHERENTLY (powers add) while the engine's WOLA normalizes for COHERENT summation (amplitudes add), so the rendered noise comes out several dB too quiet — and more so at denser overlap (time compression). Callers that know the synthesis hop set this so the morphed noise hits the target envelope level. Default 1 = uncompensated.

◆ synthesize()

template<typename SampleType = float>
void pulp::signal::NoiseMorpherT< SampleType >::synthesize ( SampleType frac,
std::complex< SampleType > * out )
inline

The documentation for this class was generated from the following file: