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

◆ generate_spectrum_ratios()

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

Generate frequency ratios for predefined spectra.

Definition at line 40 of file ModalNetwork.cpp.

42{
43 std::vector<double> ratios;
44 ratios.reserve(count);
45
46 switch (spectrum) {
48 // Perfect integer harmonics: 1, 2, 3, 4...
49 for (size_t i = 0; i < count; ++i) {
50 ratios.push_back(static_cast<double>(i + 1));
51 }
52 break;
53
55 // Bell-like spectrum (approximate mode ratios for circular plates)
56 // Based on Bessel function zeros
57 ratios = { 1.0, 2.756, 5.404, 8.933, 13.344, 18.64, 24.81, 31.86 };
58 while (ratios.size() < count) {
59 double last = ratios.back();
60 ratios.push_back(last + 6.8);
61 }
62 ratios.resize(count);
63 break;
64
66 // f_n = n * f_0 * sqrt(1 + B * n^2)
67 // Using small B = 0.0001 for moderate stretching
68 {
69 constexpr double B = 0.0001;
70 for (size_t n = 1; n <= count; ++n) {
71 double ratio = n * std::sqrt(1.0 + B * n * n);
72 ratios.push_back(ratio);
73 }
74 }
75 break;
76
78 // Should not reach here - custom ratios provided directly
79 for (size_t i = 0; i < count; ++i) {
80 ratios.push_back(static_cast<double>(i + 1));
81 }
82 break;
83 }
84
85 return ratios;
86}
#define B(method_name, full_type_name)
Definition Creator.hpp:203
@ 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, CUSTOM, HARMONIC, INHARMONIC, and STRETCHED.

Referenced by ModalNetwork().

+ Here is the caller graph for this function: