Generate frequency ratios for predefined spectra.
41{
42 std::vector<double> ratios;
43 ratios.reserve(
count);
44
45 switch (spectrum) {
47
48 for (
size_t i = 0; i <
count; ++i) {
49 ratios.push_back(static_cast<double>(i + 1));
50 }
51 break;
52
54
55
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 }
62 break;
63
65
66
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)
@ 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...