7 std::vector<double> window(length);
10 const double scale = 1.0 / (length - 1);
11 for (
size_t i = 0; i < length; ++i) {
12 window[i] = 0.5 * (1.0 - std::cos(2.0 * M_PI * i * scale));
19 std::vector<double> window(length);
22 const double scale = 1.0 / (length - 1);
23 for (
size_t i = 0; i < length; ++i) {
24 window[i] = 0.54 - 0.46 * std::cos(2.0 * M_PI * i * scale);
31 std::vector<double> window(length);
34 const double scale = 1.0 / (length - 1);
35 for (
size_t i = 0; i < length; ++i) {
36 const double x = 2.0 * M_PI * i * scale;
37 window[i] = 0.42 - 0.5 * std::cos(x) + 0.08 * std::cos(2.0 * x);
42std::vector<double>
LinearRamp(
size_t length,
double start,
double end)
44 std::vector<double> ramp(length);
47 const double step = (end - start) / (length - 1);
48 for (
size_t i = 0; i < length; ++i) {
49 ramp[i] = start + i * step;
56 std::vector<double> ramp(length);
59 const double growth = std::pow(end / start, 1.0 / (length - 1));
61 for (
size_t i = 1; i < length; ++i) {
62 ramp[i] = ramp[i - 1] * growth;
69 switch (window_type) {
std::vector< double > ExponentialRamp(size_t length, double start, double end)
Creates an exponential ramp function.
std::vector< double > BlackmanWindow(size_t length)
Creates a Blackman window function.
std::vector< double > generate_window(uint32_t size, WindowType window_type)
Generate window coefficients using C++20 ranges.
std::vector< double > LinearRamp(size_t length, double start, double end)
Creates a linear ramp function.
std::vector< double > HammingWindow(size_t length)
Creates a Hamming window function.
std::vector< double > HannWindow(size_t length)
Creates a Hann window function.