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@135
|
7
|
c@135
|
8 This program is free software; you can redistribute it and/or
|
c@135
|
9 modify it under the terms of the GNU General Public License as
|
c@135
|
10 published by the Free Software Foundation; either version 2 of the
|
c@135
|
11 License, or (at your option) any later version. See the file
|
c@135
|
12 COPYING included with this distribution for more information.
|
c@45
|
13 */
|
c@45
|
14
|
c@45
|
15 #ifndef _MFCC_PLUGIN_H_
|
c@45
|
16 #define _MFCC_PLUGIN_H_
|
c@45
|
17
|
c@45
|
18 #include <vamp-sdk/Plugin.h>
|
c@45
|
19 #include <dsp/mfcc/MFCC.h>
|
c@45
|
20
|
c@45
|
21 #include <vector>
|
c@45
|
22
|
c@45
|
23 class MFCCPlugin : public Vamp::Plugin
|
c@45
|
24 {
|
c@45
|
25 public:
|
c@45
|
26 MFCCPlugin(float inputSampleRate);
|
c@45
|
27 virtual ~MFCCPlugin();
|
c@45
|
28
|
c@45
|
29 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
|
c@45
|
30 void reset();
|
c@45
|
31
|
c@45
|
32 InputDomain getInputDomain() const { return FrequencyDomain; }
|
c@45
|
33
|
c@45
|
34 std::string getIdentifier() const;
|
c@45
|
35 std::string getName() const;
|
c@45
|
36 std::string getDescription() const;
|
c@45
|
37 std::string getMaker() const;
|
c@45
|
38 int getPluginVersion() const;
|
c@45
|
39 std::string getCopyright() const;
|
c@45
|
40
|
c@45
|
41 ParameterList getParameterDescriptors() const;
|
c@45
|
42 float getParameter(std::string) const;
|
c@45
|
43 void setParameter(std::string, float);
|
c@45
|
44
|
c@45
|
45 size_t getPreferredStepSize() const;
|
c@45
|
46 size_t getPreferredBlockSize() const;
|
c@45
|
47
|
c@45
|
48 OutputList getOutputDescriptors() const;
|
c@45
|
49
|
c@45
|
50 FeatureSet process(const float *const *inputBuffers,
|
c@45
|
51 Vamp::RealTime timestamp);
|
c@45
|
52
|
c@45
|
53 FeatureSet getRemainingFeatures();
|
c@45
|
54
|
c@45
|
55 protected:
|
c@45
|
56 int m_bins; // == nceps is m_wantC0 false or nceps+1 if m_wantC0 true
|
c@45
|
57 bool m_wantC0;
|
c@45
|
58 float m_logpower;
|
c@45
|
59
|
c@45
|
60 void setupConfig();
|
c@45
|
61
|
c@45
|
62 MFCCConfig m_config;
|
c@45
|
63 MFCC *m_mfcc;
|
c@45
|
64 mutable size_t m_step;
|
c@45
|
65 mutable size_t m_block;
|
c@45
|
66
|
c@45
|
67 std::vector<double> m_binsums;
|
c@45
|
68 size_t m_count;
|
c@45
|
69
|
c@45
|
70 Feature normalize(const Feature &);
|
c@45
|
71 };
|
c@45
|
72
|
c@45
|
73
|
c@45
|
74 #endif
|