Chris@43
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@43
|
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@7
|
14
|
c@7
|
15 #ifndef __Tempogram__Spectrogram__
|
c@7
|
16 #define __Tempogram__Spectrogram__
|
c@7
|
17 #include <vector>
|
c@7
|
18 #include <vamp-sdk/FFT.h>
|
c@7
|
19 #include <cmath>
|
Chris@31
|
20 #include <cstddef>
|
c@7
|
21
|
c@13
|
22 typedef std::vector <std::vector<float> > Spectrogram;
|
c@13
|
23 typedef std::vector <std::vector<float> > SpectrogramTransposed;
|
c@13
|
24
|
c@11
|
25 class SpectrogramProcessor{
|
c@13
|
26 size_t m_windowLength;
|
c@13
|
27 size_t m_fftLength;
|
c@13
|
28 size_t m_hopSize;
|
c@13
|
29 size_t m_numberOfOutputBins;
|
c@13
|
30 double * m_pFftInput;
|
c@13
|
31 double * m_pFftOutputReal;
|
c@13
|
32 double * m_pFftOutputImag;
|
c@7
|
33
|
c@7
|
34 void initialise();
|
c@7
|
35 void cleanup();
|
c@7
|
36 public:
|
c@14
|
37 SpectrogramProcessor(const size_t &windowLength, const size_t &fftLength, const size_t &hopSize);
|
c@11
|
38 ~SpectrogramProcessor();
|
c@13
|
39
|
c@25
|
40 Spectrogram process(const float * const pInput, const size_t &inputLength, const float * pWindow) const;
|
c@14
|
41 static SpectrogramTransposed transpose(const Spectrogram &spectrogram);
|
c@25
|
42 static float calculateMax(const Spectrogram &spectrogram);
|
c@7
|
43 };
|
c@7
|
44
|
c@7
|
45 #endif /* defined(__Tempogram__Spectrogram__) */
|