|
Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Definition at line 63 of file mass_spring_damper.hpp.
#include <mass_spring_damper.hpp>
Public Member Functions | |
| MassSpringDamper () | |
| void | set_frequency (float hz) |
| Undamped resonance, Hz. | |
| void | set_q (float q) |
| Quality factor: how many cycles the ringing lasts. | |
| void | set_mass (float m) |
| Mass in string-impedance units; heavier is closer to rigid. | |
| void | set_resonance (float hz, float q, float match) |
| The musical parametrisation: where, how wide, how much it takes. | |
| float | frequency () const |
| float | q () const |
| float | mass () const |
| float | match () const |
| The damper relative to the string's impedance: c / Z with Z = 1. | |
| float | admittance () const |
| Instantaneous admittance g: how much of this sample's force shows up in this sample's velocity. | |
| float | history () const |
| float | commit (float force) |
| Apply this sample's force and advance: returns the velocity. | |
| float | velocity () const |
| float | position () const |
| float | energy () const |
| Stored energy ½mv² + ½kx², for passivity tests. | |
| void | reset () |
| diagram::Ports | describe (diagram::Graph &g, uint8_t group, const char *name="mode") const |
| One Load node: frequency and Q. Never called from audio code (AP-037). | |
Static Public Attributes | |
| static constexpr float | MIN_FREQUENCY_HZ = 1.0f |
| static constexpr float | MAX_FREQUENCY_FRACTION = 0.45f |
| of the sample rate | |
| static constexpr float | MIN_Q = 0.05f |
| static constexpr float | MAX_Q = 1000.0f |
| static constexpr float | MIN_MASS = 1e-4f |
| static constexpr float | MAX_MASS = 1e6f |
| static constexpr float | MIN_MATCH = 1e-3f |
| static constexpr float | MAX_MATCH = 100.0f |
|
inline |
Definition at line 76 of file mass_spring_damper.hpp.
|
inline |
Undamped resonance, Hz.
Definition at line 81 of file mass_spring_damper.hpp.
References sbl::dsp::math::clamp(), MAX_FREQUENCY_FRACTION, MIN_FREQUENCY_HZ, and sbl::dsp::types::SAMPLE_RATE_F.
Referenced by set_resonance().
|
inline |
Quality factor: how many cycles the ringing lasts.
Definition at line 88 of file mass_spring_damper.hpp.
References sbl::dsp::math::clamp(), MAX_Q, MIN_Q, and q().
Referenced by set_resonance().
|
inline |
Mass in string-impedance units; heavier is closer to rigid.
Definition at line 94 of file mass_spring_damper.hpp.
References sbl::dsp::math::clamp(), MAX_MASS, and MIN_MASS.
Referenced by set_resonance().
|
inline |
The musical parametrisation: where, how wide, how much it takes.
| hz | resonance |
| q | how long it rings — also how rigid it looks away from resonance, since the mass follows from q and match |
| match | damper relative to the string's impedance at resonance; 1 absorbs the resonant wave completely |
Definition at line 108 of file mass_spring_damper.hpp.
References sbl::dsp::math::clamp(), match(), MAX_MATCH, MIN_MATCH, q(), sbl::dsp::types::SAMPLE_RATE_F, set_frequency(), set_mass(), set_q(), and sbl::dsp::math::TWO_PI.
Referenced by sbl::dsp::pm::ModalResonator< MaxModes >::set_mode(), and sbl::dsp::pm::ModalResonator< MaxModes >::set_modes().
|
inline |
Definition at line 116 of file mass_spring_damper.hpp.
|
inline |
Definition at line 117 of file mass_spring_damper.hpp.
Referenced by set_q(), and set_resonance().
|
inline |
Definition at line 118 of file mass_spring_damper.hpp.
|
inline |
The damper relative to the string's impedance: c / Z with Z = 1.
Definition at line 121 of file mass_spring_damper.hpp.
Referenced by set_resonance().
|
inline |
Instantaneous admittance g: how much of this sample's force shows up in this sample's velocity.
Definition at line 126 of file mass_spring_damper.hpp.
|
inline |
What the past state contributes to this sample's velocity, before any force. Fixed once the previous sample is committed, so it is computed there and read here — the junction reads it, then commits.
Definition at line 131 of file mass_spring_damper.hpp.
|
inline |
Apply this sample's force and advance: returns the velocity.
Definition at line 134 of file mass_spring_damper.hpp.
Referenced by sbl::dsp::pm::ModalResonator< MaxModes >::commit().
|
inline |
Definition at line 143 of file mass_spring_damper.hpp.
|
inline |
Definition at line 144 of file mass_spring_damper.hpp.
|
inline |
Stored energy ½mv² + ½kx², for passivity tests.
Definition at line 147 of file mass_spring_damper.hpp.
|
inline |
Definition at line 149 of file mass_spring_damper.hpp.
|
inline |
One Load node: frequency and Q. Never called from audio code (AP-037).
Definition at line 157 of file mass_spring_damper.hpp.
References sbl::dsp::diagram::Graph::add_node(), sbl::dsp::diagram::Ports::group, sbl::dsp::diagram::Ports::in, sbl::dsp::diagram::Load, and sbl::dsp::diagram::Ports::out.
Referenced by sbl::dsp::pm::ModalResonator< MaxModes >::describe().
|
staticconstexpr |
Definition at line 67 of file mass_spring_damper.hpp.
Referenced by set_frequency().
|
staticconstexpr |
of the sample rate
Definition at line 68 of file mass_spring_damper.hpp.
Referenced by set_frequency().
|
staticconstexpr |
Definition at line 69 of file mass_spring_damper.hpp.
Referenced by set_q().
|
staticconstexpr |
Definition at line 70 of file mass_spring_damper.hpp.
Referenced by set_q().
|
staticconstexpr |
Definition at line 71 of file mass_spring_damper.hpp.
Referenced by set_mass().
|
staticconstexpr |
Definition at line 72 of file mass_spring_damper.hpp.
Referenced by set_mass().
|
staticconstexpr |
Definition at line 73 of file mass_spring_damper.hpp.
Referenced by set_resonance().
|
staticconstexpr |
Definition at line 74 of file mass_spring_damper.hpp.
Referenced by set_resonance().