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

A parallel bank of resonant band-pass sections for fixed source-filter colour. More...

#include <formant_filter_bank.hpp>

Classes

struct  FormantSpec
struct  Recipe

Public Member Functions

bool prepare (double sample_rate, std::size_t capacity=MaxFormants) noexcept
bool prepared () const noexcept
std::size_t capacity () const noexcept
double sample_rate () const noexcept
void set_transition_samples (std::size_t samples) noexcept
std::size_t transition_samples () const noexcept
bool transition_active () const noexcept
FormantConfigureStatus configure (std::span< const FormantSpec > formants, double headroom_db=3.0) noexcept
FormantConfigureStatus configure (const Recipe &recipe) noexcept
FormantConfigureStatus configure_vowel_morph (FormantVowel from, FormantVowel to, double amount, double headroom_db=3.0) noexcept
const Recipe & requested_recipe () const noexcept
SampleType process (SampleType input) noexcept
bool process_block (const SampleType *input, SampleType *output, std::size_t frames) noexcept
bool process_block (SampleType *samples, std::size_t frames) noexcept
void reset () noexcept
double tail_seconds () const noexcept
BiquadCoefficientsT< SampleType > coefficients (std::size_t index) const noexcept
double magnitude (double frequency_hz) const noexcept
 Exact complex-sum magnitude of the requested endpoint.
double magnitude_db (double frequency_hz) const noexcept
void response_curve_db (double min_hz, double max_hz, std::span< SampleType > output) const noexcept

Static Public Member Functions

static constexpr int latency_samples () noexcept
static constexpr Recipe vowel_recipe (FormantVowel vowel) noexcept
static Recipe interpolate (const Recipe &from, const Recipe &to, double amount) noexcept

Static Public Attributes

static constexpr std::size_t storage_capacity = MaxFormants
static constexpr double min_frequency_hz = 40.0
static constexpr double min_bandwidth_hz = 20.0
static constexpr double min_q = 0.5
static constexpr double max_q = 50.0
static constexpr double min_gain_db = -60.0
static constexpr double max_gain_db = 24.0
static constexpr double min_headroom_db = 0.0
static constexpr double max_headroom_db = 24.0
static constexpr std::size_t default_transition_samples = 64

Detailed Description

template<typename SampleType = float, std::size_t MaxFormants = 5>
class pulp::signal::FormantFilterBankT< SampleType, MaxFormants >

A parallel bank of resonant band-pass sections for fixed source-filter colour.

This is an audio filter, not a formant tracker and not an STFT envelope shifter. Frequencies and bandwidths are supplied explicitly. A complete recipe is validated before any active or requested state changes. Retunes crossfade two complete stable banks; recursive coefficients are never interpolated.

Headroom policy: each band's linear weight is divided by the sum of all absolute weights and by the requested headroom gain. Since an RBJ band-pass section has at most unity steady-state magnitude, the summed response is bounded by that headroom gain. This intentionally normalizes level rather than adding a limiter or nonlinear recovery stage.

RT contract: all storage is fixed. prepare(), configure(), process(), reset(), and response inspection allocate no memory, take no locks, perform no I/O, and throw no exceptions. Configure at a block boundary. One instance owns one recursive signal path; use one instance per channel.

Member Function Documentation

◆ capacity()

template<typename SampleType = float, std::size_t MaxFormants = 5>
std::size_t pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::capacity ( ) const
inlinenoexcept

◆ coefficients()

template<typename SampleType = float, std::size_t MaxFormants = 5>
BiquadCoefficientsT< SampleType > pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::coefficients ( std::size_t index) const
inlinenoexcept

◆ configure() [1/2]

template<typename SampleType = float, std::size_t MaxFormants = 5>
FormantConfigureStatus pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::configure ( const Recipe & recipe)
inlinenoexcept

◆ configure() [2/2]

template<typename SampleType = float, std::size_t MaxFormants = 5>
FormantConfigureStatus pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::configure ( std::span< const FormantSpec > formants,
double headroom_db = 3.0 )
inlinenoexcept

◆ configure_vowel_morph()

template<typename SampleType = float, std::size_t MaxFormants = 5>
FormantConfigureStatus pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::configure_vowel_morph ( FormantVowel from,
FormantVowel to,
double amount,
double headroom_db = 3.0 )
inlinenoexcept

◆ interpolate()

template<typename SampleType = float, std::size_t MaxFormants = 5>
Recipe pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::interpolate ( const Recipe & from,
const Recipe & to,
double amount )
inlinestaticnoexcept

◆ latency_samples()

template<typename SampleType = float, std::size_t MaxFormants = 5>
constexpr int pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::latency_samples ( )
inlinestaticconstexprnoexcept

◆ magnitude()

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::magnitude ( double frequency_hz) const
inlinenoexcept

Exact complex-sum magnitude of the requested endpoint.

◆ magnitude_db()

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::magnitude_db ( double frequency_hz) const
inlinenoexcept

◆ prepare()

template<typename SampleType = float, std::size_t MaxFormants = 5>
bool pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::prepare ( double sample_rate,
std::size_t capacity = MaxFormants )
inlinenoexcept

◆ prepared()

template<typename SampleType = float, std::size_t MaxFormants = 5>
bool pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::prepared ( ) const
inlinenoexcept

◆ process()

template<typename SampleType = float, std::size_t MaxFormants = 5>
SampleType pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::process ( SampleType input)
inlinenoexcept

◆ process_block() [1/2]

template<typename SampleType = float, std::size_t MaxFormants = 5>
bool pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::process_block ( const SampleType * input,
SampleType * output,
std::size_t frames )
inlinenoexcept

◆ process_block() [2/2]

template<typename SampleType = float, std::size_t MaxFormants = 5>
bool pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::process_block ( SampleType * samples,
std::size_t frames )
inlinenoexcept

◆ requested_recipe()

template<typename SampleType = float, std::size_t MaxFormants = 5>
const Recipe & pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::requested_recipe ( ) const
inlinenoexcept

◆ reset()

template<typename SampleType = float, std::size_t MaxFormants = 5>
void pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::reset ( )
inlinenoexcept

◆ response_curve_db()

template<typename SampleType = float, std::size_t MaxFormants = 5>
void pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::response_curve_db ( double min_hz,
double max_hz,
std::span< SampleType > output ) const
inlinenoexcept

◆ sample_rate()

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::sample_rate ( ) const
inlinenoexcept

◆ set_transition_samples()

template<typename SampleType = float, std::size_t MaxFormants = 5>
void pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::set_transition_samples ( std::size_t samples)
inlinenoexcept

◆ tail_seconds()

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::tail_seconds ( ) const
inlinenoexcept

◆ transition_active()

template<typename SampleType = float, std::size_t MaxFormants = 5>
bool pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::transition_active ( ) const
inlinenoexcept

◆ transition_samples()

template<typename SampleType = float, std::size_t MaxFormants = 5>
std::size_t pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::transition_samples ( ) const
inlinenoexcept

◆ vowel_recipe()

template<typename SampleType = float, std::size_t MaxFormants = 5>
constexpr Recipe pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::vowel_recipe ( FormantVowel vowel)
inlinestaticconstexprnoexcept

Member Data Documentation

◆ default_transition_samples

template<typename SampleType = float, std::size_t MaxFormants = 5>
std::size_t pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::default_transition_samples = 64
staticconstexpr

◆ max_gain_db

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::max_gain_db = 24.0
staticconstexpr

◆ max_headroom_db

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::max_headroom_db = 24.0
staticconstexpr

◆ max_q

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::max_q = 50.0
staticconstexpr

◆ min_bandwidth_hz

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::min_bandwidth_hz = 20.0
staticconstexpr

◆ min_frequency_hz

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::min_frequency_hz = 40.0
staticconstexpr

◆ min_gain_db

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::min_gain_db = -60.0
staticconstexpr

◆ min_headroom_db

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::min_headroom_db = 0.0
staticconstexpr

◆ min_q

template<typename SampleType = float, std::size_t MaxFormants = 5>
double pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::min_q = 0.5
staticconstexpr

◆ storage_capacity

template<typename SampleType = float, std::size_t MaxFormants = 5>
std::size_t pulp::signal::FormantFilterBankT< SampleType, MaxFormants >::storage_capacity = MaxFormants
staticconstexpr

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