c@5
|
1 //
|
c@17
|
2 // NoveltyCurveProcessor.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@14
|
21 #include "SpectrogramProcessor.h"
|
c@5
|
22
|
c@14
|
23 class NoveltyCurveProcessor{
|
c@5
|
24 float m_samplingFrequency;
|
c@20
|
25 size_t m_fftLength;
|
c@20
|
26 size_t m_blockSize;
|
c@5
|
27 int m_compressionConstant;
|
c@20
|
28 size_t m_numberOfBands;
|
c@13
|
29 int * m_pBandBoundaries;
|
c@13
|
30 float * m_pBandSum;
|
c@5
|
31
|
c@5
|
32 void initialise();
|
c@5
|
33 void cleanup();
|
c@13
|
34 void subtractLocalAverage(std::vector<float> &noveltyCurve, const size_t &smoothLength) const;
|
c@22
|
35 void smoothedDifferentiator(SpectrogramTransposed &spectrogram, const size_t &smoothLength) const;
|
c@22
|
36 void halfWaveRectify(SpectrogramTransposed &spectrogram) const;
|
c@5
|
37
|
c@5
|
38 public:
|
c@5
|
39
|
c@22
|
40 NoveltyCurveProcessor(const float &samplingFrequency, const size_t &fftLength, const size_t &compressionConstant);
|
c@14
|
41 ~NoveltyCurveProcessor();
|
c@22
|
42 std::vector<float> spectrogramToNoveltyCurve(const Spectrogram &spectrogram) const;
|
c@5
|
43 };
|
c@5
|
44
|
c@5
|
45 #endif /* defined(__Tempogram__NoveltyCurve__) */
|