MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / make_hann_window

Function make_hann_window

tests/audio/stft_bench.cpp:14–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12namespace {
13
14std::vector<float> make_hann_window(int64_t win_length) {
15 std::vector<float> window(static_cast<size_t>(win_length), 0.0f);
16 if (win_length == 1) {
17 window[0] = 1.0f;
18 return window;
19 }
20 constexpr long double kPi = 3.14159265358979323846264338327950288L;
21 for (int64_t i = 0; i < win_length; ++i) {
22 window[static_cast<size_t>(i)] =
23 0.5f - 0.5f * std::cos(2.0L * kPi * static_cast<long double>(i) /
24 static_cast<long double>(win_length - 1));
25 }
26 return window;
27}
28
29} // namespace
30

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected