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

◆ HannWindow()

std::vector< double > MayaFlux::Nodes::Generator::HannWindow ( size_t  length)

Creates a Hann window function.

Parameters
lengthNumber of samples in the window
Returns
Vector containing the window function values

The Hann window (sometimes called Hanning) is a bell-shaped window function that tapers smoothly to zero at both ends. It's commonly used for:

  • Smoothing signal transitions
  • Reducing spectral leakage in frequency domain analysis
  • Creating envelope shapes for synthesis

Mathematical formula: w(n) = 0.5 * (1 - cos(2π*n/(N-1)))

Definition at line 5 of file WindowGenerator.cpp.

6{
7 std::vector<double> window(length);
8 if (length == 1)
9 return { 1.0 };
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));
13 }
14 return window;
15}

Referenced by generate_window().

+ Here is the caller graph for this function: