Mercurial > hg > vamp-tempogram
view WindowFunction.cpp @ 3:5125d34fda67
* Implemented normalisation
* Implemented threshold
* Strated implementing bandpass processing
| author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
|---|---|
| date | Wed, 09 Jul 2014 20:14:20 +0100 |
| parents | 31d2a7e07786 |
| children | 21147df9cb2d |
line wrap: on
line source
// // WindowFunction.cpp // Tempogram // // Created by Carl Bussey on 26/06/2014. // Copyright (c) 2014 Carl Bussey. All rights reserved. // #include "WindowFunction.h" #include <cmath> #include <vector> #include <iostream> using std::vector; void WindowFunction::hanning(float *signal, const unsigned int N, const bool normalise){ float sum = 0; for(int i = 0; i < N; i++){ signal[i] = 0.5*(1-cos((float)2*M_PI*i/N)); sum += signal[i]; } if (normalise){ for(int i = 0; i < N; i++){ signal[i] /= sum; } } }
