forked from dominikschnitzer/musly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindowfunction.cpp
More file actions
28 lines (23 loc) · 762 Bytes
/
windowfunction.cpp
File metadata and controls
28 lines (23 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Copyright 2013-2014, Dominik Schnitzer <dominik@schnitzer.at>
*
* This file is part of Musly, a program for high performance music
* similarity computation: http://www.musly.org/.
*
* This Source Code Form is subject to the terms of the Mozilla
* Public License v. 2.0. If a copy of the MPL was not distributed
* with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <iostream>
#include <cmath>
#include "windowfunction.h"
namespace musly {
Eigen::VectorXf windowfunction::hann(
int window_size)
{
int N = window_size - 1;
Eigen::VectorXf n = Eigen::VectorXf::LinSpaced(window_size, 0, N);
Eigen::VectorXf w = 0.5f * (1.0f - (2.0f*M_PI*n/N).array().cos());
return w;
}
} /* namespace musly */