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

The Hamming 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 Hamming function.

Detailed Description

The Hamming raised-cosine window.

Definition at line 109 of file WindowFunctions.hpp.

Member Function Documentation

◆ operator()()

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

Maps the index into the Hamming function.

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

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

where

\[ \alpha = 0.54,\quad \beta = 1 - \alpha = 0.46. \]

for index \( n \).

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

Definition at line 30 of file WindowFunctions.cpp.

34{
35 if (size <= 1)
36 return 1.0f;
37
38 constexpr float hamming_ratio = 25.0f / 46;
39 return hamming_ratio - (1.0f - hamming_ratio) * std::cos(
40 2.0f * std::numbers::pi_v<float> *
41 static_cast<float>(index) / static_cast<float>(size - 1)
42 );
43}
T cos(T... args)

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