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

◆ generate_spectrum_ratios()

std::vector< double > MayaFlux::Nodes::Network::ModalNetwork::generate_spectrum_ratios ( Spectrum  spectrum,
size_t  count 
)
staticprivate

Generate frequency ratios for predefined spectra.

Definition at line 39 of file ModalNetwork.cpp.

41{
42 std::vector<double> ratios;
43 ratios.reserve(count);
44
45 switch (spectrum) {
47 // Perfect integer harmonics: 1, 2, 3, 4...
48 for (size_t i = 0; i < count; ++i) {
49 ratios.push_back(static_cast<double>(i + 1));
50 }
51 break;
52
54 // Bell-like spectrum (approximate mode ratios for circular plates)
55 // Based on Bessel function zeros
56 ratios = { 1.0, 2.756, 5.404, 8.933, 13.344, 18.64, 24.81, 31.86 };
57 while (ratios.size() < count) {
58 double last = ratios.back();
59 ratios.push_back(last + 6.8);
60 }
61 ratios.resize(count);
62 break;
63
65 // f_n = n * f_0 * sqrt(1 + B * n^2)
66 // Using small B = 0.0001 for moderate stretching
67 {
68 constexpr double B = 0.0001;
69 for (size_t n = 1; n <= count; ++n) {
70 double ratio = n * std::sqrt(1.0 + B * n * n);
71 ratios.push_back(ratio);
72 }
73 }
74 break;
75
77 for (size_t i = 0; i < count; ++i) {
78 ratios.push_back(static_cast<double>(i + 1));
79 }
80 break;
81 }
82
83 return ratios;
84}
#define B(method_name, full_type_name)
Definition Creator.hpp:203
Eigen::Index count
@ STRETCHED
Piano-like stiffness: f, 2.01f, 3.02f, 4.04f...
@ INHARMONIC
Bell-like: f, 2.76f, 5.40f, 8.93f, 13.34f...
@ CUSTOM
User-provided frequency ratios.
@ HARMONIC
Integer harmonics: f, 2f, 3f, 4f...

References B, count, CUSTOM, HARMONIC, INHARMONIC, and STRETCHED.

Referenced by ModalNetwork().

+ Here is the caller graph for this function: