MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ resonator()

MAYAFLUX_API void MayaFlux::Kinesis::Discrete::resonator ( double  pole_radius,
double  pole_angle,
std::vector< double > &  a,
std::vector< double > &  b 
)

Two-pole resonator specified by z-plane pole position.

Places a conjugate pole pair at radius pole_radius and angle pole_angle rather than deriving them from a cutoff and Q. Ring time grows as the radius approaches 1.0; the resonant frequency is pole_angle * sample_rate / (2 * pi).

The numerator is a single scalar normalising peak magnitude to unity, so b has length 1 and no zeros are placed. For a resonator with zeros at DC and Nyquist, use biquad_bandpass instead.

Parameters
pole_radiusPole magnitude, clamped to [0, 0.9999]
pole_anglePole angle in radians, in [0, pi]
aDenominator output, resized to 3, a[0] == 1.0
bNumerator output, resized to 1

Definition at line 270 of file Coefficients.cpp.

272{
273 const double r = std::clamp(pole_radius, 0.0, 0.9999);
274 const double theta = std::clamp(pole_angle, 0.0, std::numbers::pi);
275 const double cos_theta = std::cos(theta);
276
277 a.assign({ 1.0, -2.0 * r * cos_theta, r * r });
278
279 const double gain = (1.0 - r)
280 * std::sqrt(1.0 - 2.0 * r * std::cos(2.0 * theta) + r * r);
281 b.assign({ gain });
282}
size_t a
size_t b

References a, and b.