Mercurial > hg > vamp-tempogram
comparison NoveltyCurve.h @ 13:7680cc4c0073
* Tidying - made length of array variables type size_t and for loops unsigned int, where index > 0.
* Window length parameter is now a dropdown box.
author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
---|---|
date | Wed, 13 Aug 2014 14:18:00 +0100 |
parents | 09fb76606b2b |
children |
comparison
equal
deleted
inserted
replaced
12:d58409ecd720 | 13:7680cc4c0073 |
---|---|
16 #include <vector> | 16 #include <vector> |
17 #include <iostream> | 17 #include <iostream> |
18 #include "FIRFilter.h" | 18 #include "FIRFilter.h" |
19 #include "WindowFunction.h" | 19 #include "WindowFunction.h" |
20 #include <cassert> | 20 #include <cassert> |
21 #include "Spectrogram.h" | |
21 | 22 |
22 class NoveltyCurve{ | 23 class NoveltyCurve{ |
23 float m_samplingFrequency; | 24 float m_samplingFrequency; |
24 int m_fftLength; | 25 int m_fftLength; |
25 int m_blockSize; | 26 int m_blockSize; |
26 int m_numberOfBlocks; | 27 int m_numberOfBlocks; |
27 int m_compressionConstant; | 28 int m_compressionConstant; |
28 int m_numberOfBands; | 29 int m_numberOfBands; |
29 int * m_bandBoundaries; | 30 int * m_pBandBoundaries; |
30 int m_hannLength; | 31 float * m_pBandSum; |
31 float * m_bandSum; | |
32 std::vector<float> data; | |
33 | 32 |
34 void initialise(); | 33 void initialise(); |
35 void cleanup(); | 34 void cleanup(); |
36 float calculateMax(std::vector< std::vector<float> > &spectrogram); | 35 float calculateMax(const std::vector< std::vector<float> > &spectrogram) const; |
37 void subtractLocalAverage(std::vector<float> &noveltyCurve); | 36 void subtractLocalAverage(std::vector<float> &noveltyCurve, const size_t &smoothLength) const; |
38 void smoothedDifferentiator(std::vector< std::vector<float> > &spectrogram, int smoothLength); | 37 void smoothedDifferentiator(std::vector< std::vector<float> > &spectrogram, const size_t &smoothLength) const; |
39 void halfWaveRectify(std::vector< std::vector<float> > &spectrogram); | 38 void halfWaveRectify(std::vector< std::vector<float> > &spectrogram) const; |
40 | 39 |
41 public: | 40 public: |
42 | 41 |
43 NoveltyCurve(float samplingFrequency, int fftLength, int numberOfBlocks, int compressionConstant); | 42 NoveltyCurve(const float &samplingFrequency, const size_t &fftLength, const size_t &numberOfBlocks, const size_t &compressionConstant); |
44 ~NoveltyCurve(); | 43 ~NoveltyCurve(); |
45 std::vector<float> spectrogramToNoveltyCurve(std::vector< std::vector<float> > spectrogram); | 44 std::vector<float> spectrogramToNoveltyCurve(Spectrogram spectrogram) const; |
46 }; | 45 }; |
47 | 46 |
48 #endif /* defined(__Tempogram__NoveltyCurve__) */ | 47 #endif /* defined(__Tempogram__NoveltyCurve__) */ |