change lower pitch limit to D#1
[vamp-aubio-plugins.git] / plugins / Notes.h
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
2
3 /*
4     Vamp feature extraction plugins using Paul Brossier's Aubio library.
5
6     Centre for Digital Music, Queen Mary, University of London.
7     This file copyright 2006 Chris Cannam.
8     
9     This program is free software; you can redistribute it and/or
10     modify it under the terms of the GNU General Public License as
11     published by the Free Software Foundation; either version 2 of the
12     License, or (at your option) any later version.  See the file
13     COPYING included with this distribution for more information.
14
15 */
16
17 #ifndef _NOTES_PLUGIN_H_
18 #define _NOTES_PLUGIN_H_
19
20 #include <vamp-sdk/Plugin.h>
21 #include <aubio/aubio.h>
22
23 #include <deque>
24
25 class Notes : public Vamp::Plugin
26 {
27 public:
28     Notes(float inputSampleRate);
29     virtual ~Notes();
30
31     bool initialise(size_t channels, size_t stepSize, size_t blockSize);
32     void reset();
33
34     InputDomain getInputDomain() const { return TimeDomain; }
35
36     std::string getName() const;
37     std::string getDescription() const;
38     std::string getMaker() const;
39     int getPluginVersion() const;
40     std::string getCopyright() const;
41
42     ParameterList getParameterDescriptors() const;
43     float getParameter(std::string) const;
44     void setParameter(std::string, float);
45
46     size_t getPreferredStepSize() const;
47     size_t getPreferredBlockSize() const;
48
49     OutputList getOutputDescriptors() const;
50
51     FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp);
52
53     FeatureSet getRemainingFeatures();
54
55 protected:
56     fvec_t *m_ibuf;
57     cvec_t *m_fftgrain;
58     fvec_t *m_onset;
59     aubio_pvoc_t *m_pv;
60     aubio_pickpeak_t *m_peakpick;
61     aubio_onsetdetection_t *m_onsetdet;
62     aubio_onsetdetection_type m_onsettype;
63     aubio_pitchdetection_t *m_pitchdet;
64     aubio_pitchdetection_type m_pitchtype;
65     aubio_pitchdetection_mode m_pitchmode;
66     float m_threshold;
67     float m_silence;
68     size_t m_median;
69     size_t m_stepSize;
70     size_t m_blockSize;
71     size_t m_channelCount;
72     int m_minpitch;
73     int m_maxpitch;
74     bool m_wrapRange;
75     bool m_avoidLeaps;
76     std::deque<float> m_notebuf;
77     size_t m_count;
78     Vamp::RealTime m_delay;
79     Vamp::RealTime m_currentOnset;
80     Vamp::RealTime m_lastTimeStamp;
81     float m_currentLevel;
82     bool m_haveCurrent;
83     int m_prevPitch;
84
85     void pushNote(FeatureSet &, const Vamp::RealTime &);
86 };
87
88
89 #endif