EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Loading...
Searching...
No Matches
echomap::WindowFunctions::Hann Struct Reference

The Hann raised-cosine window. More...

#include <WindowFunctions.hpp>

Static Public Member Functions

static float operator() (std::size_t index, std::size_t size) noexcept
 Maps the index into the Hann function.

Detailed Description

The Hann raised-cosine window.

Definition at line 79 of file WindowFunctions.hpp.

Member Function Documentation

◆ operator()()

float echomap::WindowFunctions::Hann::operator() ( std::size_t index,
std::size_t size )
staticnoexcept

Maps the index into the Hann function.

For a window of size \( M \), let \( N = M - 1 \).

\[ w[n] = \frac{1}{2} \left( 1 - \cos\left(\frac{2\pi n}{N}\right) \right) \]

for index \( n \).

Parameters
indexThe index within the window.
sizeThe size of the window.
Returns
The Hann-mapped index.

Definition at line 18 of file WindowFunctions.cpp.

22{
23 if (size <= 1)
24 return 1.0f;
25
26 const auto sine = std::sin(std::numbers::pi_v<float> * static_cast<float>(index) / static_cast<float>(size - 1));
27 return sine * sine;
28}
T sin(T... args)

The documentation for this struct was generated from the following files: