annotate NoveltyCurve.h @ 11:09fb76606b2b
* Removed many unnecessary heap allocations with objects
author |
Carl Bussey <c.bussey@se10.qmul.ac.uk> |
date |
Wed, 13 Aug 2014 10:45:46 +0100 |
parents |
be59b4a73f49 |
children |
7680cc4c0073 |
rev |
line source |
c@5
|
1 //
|
c@5
|
2 // NoveltyCurve.h
|
c@5
|
3 // Tempogram
|
c@5
|
4 //
|
c@5
|
5 // Created by Carl Bussey on 10/07/2014.
|
c@5
|
6 // Copyright (c) 2014 Carl Bussey. All rights reserved.
|
c@5
|
7 //
|
c@5
|
8
|
c@11
|
9 // Don't new delete objects
|
c@11
|
10
|
c@5
|
11 #ifndef __Tempogram__NoveltyCurve__
|
c@5
|
12 #define __Tempogram__NoveltyCurve__
|
c@5
|
13
|
c@5
|
14 #include <iostream>
|
c@7
|
15 #include <cmath>
|
c@7
|
16 #include <vector>
|
c@7
|
17 #include <iostream>
|
c@7
|
18 #include "FIRFilter.h"
|
c@7
|
19 #include "WindowFunction.h"
|
c@7
|
20 #include <cassert>
|
c@5
|
21
|
c@5
|
22 class NoveltyCurve{
|
c@5
|
23 float m_samplingFrequency;
|
c@7
|
24 int m_fftLength;
|
c@5
|
25 int m_blockSize;
|
c@5
|
26 int m_numberOfBlocks;
|
c@5
|
27 int m_compressionConstant;
|
c@5
|
28 int m_numberOfBands;
|
c@5
|
29 int * m_bandBoundaries;
|
c@5
|
30 int m_hannLength;
|
c@7
|
31 float * m_bandSum;
|
c@11
|
32 std::vector<float> data;
|
c@5
|
33
|
c@5
|
34 void initialise();
|
c@5
|
35 void cleanup();
|
c@7
|
36 float calculateMax(std::vector< std::vector<float> > &spectrogram);
|
c@7
|
37 void subtractLocalAverage(std::vector<float> &noveltyCurve);
|
c@7
|
38 void smoothedDifferentiator(std::vector< std::vector<float> > &spectrogram, int smoothLength);
|
c@7
|
39 void halfWaveRectify(std::vector< std::vector<float> > &spectrogram);
|
c@5
|
40
|
c@5
|
41 public:
|
c@5
|
42
|
c@7
|
43 NoveltyCurve(float samplingFrequency, int fftLength, int numberOfBlocks, int compressionConstant);
|
c@5
|
44 ~NoveltyCurve();
|
c@11
|
45 std::vector<float> spectrogramToNoveltyCurve(std::vector< std::vector<float> > spectrogram);
|
c@5
|
46 };
|
c@5
|
47
|
c@5
|
48 #endif /* defined(__Tempogram__NoveltyCurve__) */
|