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

The Bartlett triangular 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 Bartlett function.

Detailed Description

The Bartlett triangular window.

Definition at line 145 of file WindowFunctions.hpp.

Member Function Documentation

◆ operator()()

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

Maps the index into the Bartlett function.

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

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

for index \( n \).

The endpoints are zero and the centre approaches one. For even window sizes, the exact value one does not occur at an integer index.

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

Definition at line 53 of file WindowFunctions.cpp.

57{
58 if (size <= 1)
59 return 1.0f;
60
61 const auto centre = static_cast<float>(size - 1) / 2.0f;
62 return (2.0f / static_cast<float>(size - 1)) * (centre - std::abs(static_cast<float>(index) - centre));
63}
T size(T... args)

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