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

The Blackman cosine-sum 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 Blackman function.

Detailed Description

The Blackman cosine-sum window.

Definition at line 180 of file WindowFunctions.hpp.

Member Function Documentation

◆ operator()()

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

Maps the index into the Blackman function.

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

\[ w[n] = 0.42 - 0.5\cos\left(\frac{2\pi n}{N}\right) + 0.08\cos\left(\frac{4\pi n}{N}\right) \]

for index \( n \).

This is the common approximate Blackman window, not the exact sidelobe-nulling Blackman variant.

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

Definition at line 65 of file WindowFunctions.cpp.

69{
70 if (size <= 1)
71 return 1.0f;
72
73 const auto phase = 2.0f * std::numbers::pi_v<float> * static_cast<float>(index) / static_cast<float>(size - 1);
74 return 0.42f - 0.5f * std::cos(phase) + 0.08f * std::cos(2.0f * phase);
75}
T cos(T... args)

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