Chris@0
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@7
|
2 /*
|
Chris@7
|
3 Permission is hereby granted, free of charge, to any person
|
Chris@7
|
4 obtaining a copy of this software and associated documentation
|
Chris@7
|
5 files (the "Software"), to deal in the Software without
|
Chris@7
|
6 restriction, including without limitation the rights to use, copy,
|
Chris@7
|
7 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@7
|
8 of the Software, and to permit persons to whom the Software is
|
Chris@7
|
9 furnished to do so, subject to the following conditions:
|
Chris@7
|
10
|
Chris@7
|
11 The above copyright notice and this permission notice shall be
|
Chris@7
|
12 included in all copies or substantial portions of the Software.
|
Chris@7
|
13
|
Chris@7
|
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@7
|
15 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@7
|
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@7
|
17 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
|
Chris@7
|
18 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@7
|
19 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@7
|
20 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@7
|
21 */
|
Chris@0
|
22
|
Chris@0
|
23 #ifndef _SIMPLE_CEPSTRUM_H_
|
Chris@0
|
24 #define _SIMPLE_CEPSTRUM_H_
|
Chris@0
|
25
|
Chris@0
|
26 #include <vamp-sdk/Plugin.h>
|
Chris@0
|
27
|
Chris@0
|
28 class SimpleCepstrum : public Vamp::Plugin
|
Chris@0
|
29 {
|
Chris@0
|
30 public:
|
Chris@0
|
31 SimpleCepstrum(float inputSampleRate);
|
Chris@0
|
32 virtual ~SimpleCepstrum();
|
Chris@0
|
33
|
Chris@0
|
34 std::string getIdentifier() const;
|
Chris@0
|
35 std::string getName() const;
|
Chris@0
|
36 std::string getDescription() const;
|
Chris@0
|
37 std::string getMaker() const;
|
Chris@0
|
38 int getPluginVersion() const;
|
Chris@0
|
39 std::string getCopyright() const;
|
Chris@0
|
40
|
Chris@0
|
41 InputDomain getInputDomain() const;
|
Chris@0
|
42 size_t getPreferredBlockSize() const;
|
Chris@0
|
43 size_t getPreferredStepSize() const;
|
Chris@0
|
44 size_t getMinChannelCount() const;
|
Chris@0
|
45 size_t getMaxChannelCount() const;
|
Chris@0
|
46
|
Chris@0
|
47 ParameterList getParameterDescriptors() const;
|
Chris@0
|
48 float getParameter(std::string identifier) const;
|
Chris@0
|
49 void setParameter(std::string identifier, float value);
|
Chris@0
|
50
|
Chris@0
|
51 ProgramList getPrograms() const;
|
Chris@0
|
52 std::string getCurrentProgram() const;
|
Chris@0
|
53 void selectProgram(std::string name);
|
Chris@0
|
54
|
Chris@0
|
55 OutputList getOutputDescriptors() const;
|
Chris@0
|
56
|
Chris@0
|
57 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
|
Chris@0
|
58 void reset();
|
Chris@0
|
59
|
Chris@0
|
60 FeatureSet process(const float *const *inputBuffers,
|
Chris@0
|
61 Vamp::RealTime timestamp);
|
Chris@0
|
62
|
Chris@0
|
63 FeatureSet getRemainingFeatures();
|
Chris@0
|
64
|
Chris@0
|
65 protected:
|
Chris@0
|
66 size_t m_channels;
|
Chris@0
|
67 size_t m_stepSize;
|
Chris@0
|
68 size_t m_blockSize;
|
Chris@0
|
69 float m_fmin;
|
Chris@0
|
70 float m_fmax;
|
Chris@5
|
71 int m_histlen;
|
Chris@10
|
72 int m_vflen;
|
Chris@0
|
73 bool m_clamp;
|
Chris@0
|
74
|
Chris@3
|
75 enum Method {
|
Chris@3
|
76 InverseSymmetric,
|
Chris@3
|
77 InverseAsymmetric,
|
Chris@4
|
78 InverseComplex,
|
Chris@3
|
79 ForwardMagnitude,
|
Chris@3
|
80 ForwardDifference
|
Chris@3
|
81 };
|
Chris@3
|
82
|
Chris@3
|
83 Method m_method;
|
Chris@3
|
84
|
Chris@5
|
85 mutable int m_pkOutput;
|
Chris@0
|
86 mutable int m_varOutput;
|
Chris@5
|
87 mutable int m_p2rOutput;
|
Chris@0
|
88 mutable int m_cepOutput;
|
Chris@0
|
89 mutable int m_pvOutput;
|
Chris@0
|
90 mutable int m_amOutput;
|
Chris@2
|
91 mutable int m_envOutput;
|
Chris@2
|
92 mutable int m_esOutput;
|
Chris@6
|
93 mutable int m_ppOutput;
|
Chris@6
|
94 mutable int m_totOutput;
|
Chris@20
|
95 mutable int m_pkoOutput;
|
Chris@0
|
96
|
Chris@5
|
97 int m_binFrom;
|
Chris@5
|
98 int m_binTo;
|
Chris@5
|
99 int m_bins; // count of "interesting" bins, those returned in m_cepOutput
|
Chris@5
|
100
|
Chris@5
|
101 double **m_history;
|
Chris@5
|
102
|
Chris@5
|
103 void filter(const double *in, double *out);
|
Chris@0
|
104 void fft(unsigned int n, bool inverse,
|
Chris@0
|
105 double *ri, double *ii, double *ro, double *io);
|
Chris@5
|
106
|
Chris@5
|
107 void addStatisticalOutputs(FeatureSet &fs, const double *data);
|
Chris@5
|
108 void addEnvelopeOutputs(FeatureSet &fs, const float *const *inputBuffers,
|
Chris@5
|
109 const double *raw);
|
Chris@0
|
110 };
|
Chris@0
|
111
|
Chris@0
|
112 #endif
|