MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nodes::Network::ReedOperator Class Referencefinal

Quasi-static single reed driven by a blowing pressure. More...

#include <TerminationOperators.hpp>

Inheritance diagram for MayaFlux::Nodes::Network::ReedOperator:
Collaboration diagram for MayaFlux::Nodes::Network::ReedOperator:

Public Types

using Controls = ReedControls

Public Member Functions

bool accepts (const Kinesis::Acoustics::DuctGrid &grid, const Kinesis::Acoustics::DuctSpec &spec, DuctEnd end) const override
 Whether prepare would succeed for this grid and end.
std::pair< double, double > couple (double end_pressure, double interior_flow) override
 Advance the end cell and its coupling by one sample.
std::string_view get_type_name () const override
 Type name for introspection.
void prepare (const Kinesis::Acoustics::DuctGrid &grid, const Kinesis::Acoustics::DuctSpec &spec, DuctEnd end) override
 Bind to a grid and end, and reset the state.
void process (float frames) override
 Process for one batch cycle.
std::optional< double > query_state (std::string_view query) const override
 Query operator internal state.
void read_controls (ReedControls &controls) const
 Fills every control with the value the reed holds now.
 ReedOperator (double width=0.012, double rest_opening=4.0e-4, double closing_pressure=3000.0)
void reset () override
 Clear the state, keeping the parameters.
void retarget (const Kinesis::Acoustics::DuctGrid &grid, const Kinesis::Acoustics::DuctSpec &spec, DuctEnd end) override
 Bind to a new grid of the same duct while it keeps sounding.
void set_parameter (std::string_view param, double value) override
 Set operator parameter.
Public Member Functions inherited from MayaFlux::Nodes::Network::TerminationOperator
void process (float) override
 Process for one batch cycle.
std::optional< double > query_state (std::string_view) const override
 Query operator internal state.
void set_parameter (std::string_view, double) override
 Set operator parameter.
Public Member Functions inherited from MayaFlux::Nodes::Network::NetworkOperator
virtual void apply_mapped_one_to_one (ParameterKey key, const std::shared_ptr< NodeNetwork > &source)
 Apply a cached per-element key, delegating to apply_one_to_one by default.
virtual void apply_one_to_one (std::string_view param, const std::shared_ptr< NodeNetwork > &source)
 Apply ONE_TO_ONE parameter mapping (per-point control).
virtual bool demands_full_vertex_restore () const
 Whether a downstream compute pass writes the network's vertex buffer in place each cycle, so the geometry producer must keep restoring the CPU-authoritative vertex data every frame.
template<typename Self>
Self::Controls get (this const Self &self)
 The controls with the values the operator holds now.
template<typename Self>
void set (this Self &self, const typename Self::Controls &incoming)
 Apply the members of this operator's Controls struct that hold a value.
virtual void set_mapped_parameter (ParameterKey key, double value)
 Apply a cached mapping key, delegating to set_parameter by default.
virtual ~NetworkOperator ()=default

Private Member Functions

void apply_controls ()
Kinesis::Acoustics::ReedChannel channel () const noexcept
double next_white () noexcept

Private Attributes

double m_alpha { 1.0 }
std::atomic< double > m_closing_pressure
ReedControls & m_controls
double m_density { 1.2 }
double m_end_gain {}
double m_last_flow {}
std::atomic< double > m_lip { 0.0 }
std::array< double, 2 > m_motion {}
std::atomic< double > m_noise { 0.0 }
double m_noise_alpha { 1.0 }
std::atomic< double > m_noise_cutoff { 3000.0 }
double m_noise_scale { 1.0 }
double m_noise_state {}
double m_pressure {}
uint64_t m_random { 0x9E3779B97F4A7C15ULL }
std::atomic< double > m_reed_area { 0.0 }
std::atomic< double > m_reed_damping { 15000.0 }
std::atomic< double > m_resonance { 0.0 }
std::atomic< double > m_rest_opening
std::atomic< double > m_smoothing { 0.005 }
std::atomic< double > m_target_pressure { 0.0 }
double m_time_step {}
std::atomic< bool > m_unique { true }
double m_warm_start {}
std::atomic< double > m_width

Additional Inherited Members

Protected Member Functions inherited from MayaFlux::Nodes::Network::NetworkOperator
template<typename C>
C & declare_controls ()
 Create the operator's controls struct and keep it alive.
template<typename C>
void merge_controls (const C &incoming)
 Apply the members of incoming that hold a value, for an operator whose controls type is not fixed.
void refresh_controls ()
 Read node sources into their controls.
bool set_named_control (std::string_view name, double value)
 Sets the control called name, the way set() would.
bool settle_named_control (std::string_view name)
 Drops the pending typed value of the control called name.
template<typename C>
C snapshot_controls () const
 A copy of the declared struct, for an operator whose controls type is not fixed.

Detailed Description

Quasi-static single reed driven by a blowing pressure.

Parameters: "pressure" (Pa, smoothed per sample), "closing_pressure", "opening", "width" and "smoothing" (seconds of the blowing pressure's one pole smoothing, zero for none). query_state also answers "unique": 1 while the coupling has a single solution for the current values, which is checked at the start of each block. When it is 0 the solution follows the branch of the previous sample.

Four more give the reed a life of its own. "resonance" (Hz) turns the rigid reed into a damped oscillator at that frequency, with "reed_damping" (1/s, 15000 by default) as its loss; zero resonance, the default, keeps the quasi-static reed. A reed with dynamics puts a formant at its resonance, shapes the attack, and is unique for every value. With the damping below about 5000 and a resonance near 2500 the reed sustains its own oscillation, a squeal near the resonance, instead of the note of the duct.

"reed_area" (m^2, zero by default) adds the air the moving reed pushes, minus that area times the reed's velocity, to the flow into the duct; 1.46e-4 is the value used by Avanzini and Rocchesso for a clarinet. "lip" (0 to 1) is the embouchure, a lip pressed against the reed: at 1 the rest opening is reduced by a fifth, the resonance and the closing pressure rise by 40 percent and the damping doubles. A narrower opening lowers the loop gain, so a note near its threshold goes quiet as the lip closes unless the blowing pressure rises with it. The coefficients are a first approximation.

"noise" is the breath: an extra flow into the duct, with an rms of that fraction of the reed's own flow, so it swells and fades with the note and is silent when the reed is shut. Its colour is a one pole low-pass at "noise_cutoff" (Hz, 3000 by default). A few hundredths is a hint of breath, a few tenths a breathy note. The noise is a fixed, repeatable sequence.

Definition at line 186 of file TerminationOperators.hpp.


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