Chris@43
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
c@5
|
2
|
Chris@43
|
3 /*
|
Chris@43
|
4 Vamp Tempogram Plugin
|
Chris@43
|
5 Carl Bussey, Centre for Digital Music, Queen Mary University of London
|
Chris@43
|
6 Copyright 2014 Queen Mary University of London.
|
Chris@43
|
7
|
Chris@43
|
8 This program is free software; you can redistribute it and/or
|
Chris@43
|
9 modify it under the terms of the GNU General Public License as
|
Chris@43
|
10 published by the Free Software Foundation; either version 2 of the
|
Chris@43
|
11 License, or (at your option) any later version. See the file
|
Chris@43
|
12 COPYING included with this distribution for more information.
|
Chris@43
|
13 */
|
c@11
|
14
|
c@5
|
15 #ifndef __Tempogram__NoveltyCurve__
|
c@5
|
16 #define __Tempogram__NoveltyCurve__
|
c@5
|
17
|
c@5
|
18 #include <iostream>
|
c@7
|
19 #include <cmath>
|
c@7
|
20 #include <vector>
|
c@7
|
21 #include <iostream>
|
c@7
|
22 #include "FIRFilter.h"
|
c@7
|
23 #include "WindowFunction.h"
|
c@7
|
24 #include <cassert>
|
c@14
|
25 #include "SpectrogramProcessor.h"
|
c@5
|
26
|
c@14
|
27 class NoveltyCurveProcessor{
|
c@5
|
28 float m_samplingFrequency;
|
c@20
|
29 size_t m_fftLength;
|
c@20
|
30 size_t m_blockSize;
|
c@5
|
31 int m_compressionConstant;
|
c@20
|
32 size_t m_numberOfBands;
|
c@13
|
33 int * m_pBandBoundaries;
|
c@13
|
34 float * m_pBandSum;
|
c@5
|
35
|
c@5
|
36 void initialise();
|
c@5
|
37 void cleanup();
|
c@13
|
38 void subtractLocalAverage(std::vector<float> &noveltyCurve, const size_t &smoothLength) const;
|
c@22
|
39 void smoothedDifferentiator(SpectrogramTransposed &spectrogram, const size_t &smoothLength) const;
|
c@22
|
40 void halfWaveRectify(SpectrogramTransposed &spectrogram) const;
|
c@5
|
41
|
c@5
|
42 public:
|
c@5
|
43
|
c@22
|
44 NoveltyCurveProcessor(const float &samplingFrequency, const size_t &fftLength, const size_t &compressionConstant);
|
c@14
|
45 ~NoveltyCurveProcessor();
|
c@22
|
46 std::vector<float> spectrogramToNoveltyCurve(const Spectrogram &spectrogram) const;
|
c@5
|
47 };
|
c@5
|
48
|
c@5
|
49 #endif /* defined(__Tempogram__NoveltyCurve__) */
|