c@45
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
c@45
|
2
|
c@45
|
3 /*
|
c@45
|
4 QM Vamp Plugin Set
|
c@45
|
5
|
c@45
|
6 Centre for Digital Music, Queen Mary, University of London.
|
c@45
|
7 All rights reserved.
|
c@45
|
8 */
|
c@45
|
9
|
c@45
|
10 #ifndef _MFCC_PLUGIN_H_
|
c@45
|
11 #define _MFCC_PLUGIN_H_
|
c@45
|
12
|
c@45
|
13 #include <vamp-sdk/Plugin.h>
|
c@45
|
14 #include <dsp/mfcc/MFCC.h>
|
c@45
|
15
|
c@45
|
16 #include <vector>
|
c@45
|
17
|
c@45
|
18 class MFCCPlugin : public Vamp::Plugin
|
c@45
|
19 {
|
c@45
|
20 public:
|
c@45
|
21 MFCCPlugin(float inputSampleRate);
|
c@45
|
22 virtual ~MFCCPlugin();
|
c@45
|
23
|
c@45
|
24 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
|
c@45
|
25 void reset();
|
c@45
|
26
|
c@45
|
27 InputDomain getInputDomain() const { return FrequencyDomain; }
|
c@45
|
28
|
c@45
|
29 std::string getIdentifier() const;
|
c@45
|
30 std::string getName() const;
|
c@45
|
31 std::string getDescription() const;
|
c@45
|
32 std::string getMaker() const;
|
c@45
|
33 int getPluginVersion() const;
|
c@45
|
34 std::string getCopyright() const;
|
c@45
|
35
|
c@45
|
36 ParameterList getParameterDescriptors() const;
|
c@45
|
37 float getParameter(std::string) const;
|
c@45
|
38 void setParameter(std::string, float);
|
c@45
|
39
|
c@45
|
40 size_t getPreferredStepSize() const;
|
c@45
|
41 size_t getPreferredBlockSize() const;
|
c@45
|
42
|
c@45
|
43 OutputList getOutputDescriptors() const;
|
c@45
|
44
|
c@45
|
45 FeatureSet process(const float *const *inputBuffers,
|
c@45
|
46 Vamp::RealTime timestamp);
|
c@45
|
47
|
c@45
|
48 FeatureSet getRemainingFeatures();
|
c@45
|
49
|
c@45
|
50 protected:
|
c@45
|
51 int m_bins; // == nceps is m_wantC0 false or nceps+1 if m_wantC0 true
|
c@45
|
52 bool m_wantC0;
|
c@45
|
53 float m_logpower;
|
c@45
|
54
|
c@45
|
55 void setupConfig();
|
c@45
|
56
|
c@45
|
57 MFCCConfig m_config;
|
c@45
|
58 MFCC *m_mfcc;
|
c@45
|
59 mutable size_t m_step;
|
c@45
|
60 mutable size_t m_block;
|
c@45
|
61
|
c@45
|
62 std::vector<double> m_binsums;
|
c@45
|
63 size_t m_count;
|
c@45
|
64
|
c@45
|
65 Feature normalize(const Feature &);
|
c@45
|
66 };
|
c@45
|
67
|
c@45
|
68
|
c@45
|
69 #endif
|