annotate SimpleCepstrum.h @ 46:a17bca16933a tip

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