-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmf0UA.h
101 lines (75 loc) · 2.42 KB
/
mf0UA.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// This is a skeleton file for use in creating your own plugin
// libraries. Replace MyPlugin and myPlugin throughout with the name
// of your first plugin class, and fill in the gaps as appropriate.
// Remember to use a different guard symbol in each header!
#ifndef _MF0UA_H_
#define _MF0UA_H_
#include <vamp-sdk/Plugin.h>
#include "info.h"
#include "bands.h"
#include "chord.h"
#include "defines.h"
#include "peaksatt.h"
#include "mf0.h"
using std::string;
class MF0UA : public Vamp::Plugin
{
public:
MF0UA(float inputSampleRate);
virtual ~MF0UA();
string getIdentifier() const;
string getName() const;
string getDescription() const;
string getMaker() const;
int getPluginVersion() const;
string getCopyright() const;
InputDomain getInputDomain() const;
size_t getPreferredBlockSize() const;
size_t getPreferredStepSize() const;
size_t getMinChannelCount() const;
size_t getMaxChannelCount() const;
ParameterList getParameterDescriptors() const;
float getParameter(string identifier) const;
void setParameter(string identifier, float value);
ProgramList getPrograms() const;
string getCurrentProgram() const;
void selectProgram(string name);
OutputList getOutputDescriptors() const;
bool initialise(size_t channels, size_t stepSize, size_t blockSize);
void reset();
FeatureSet process(const float *const *inputBuffers,
Vamp::RealTime timestamp);
FeatureSet getRemainingFeatures();
protected:
void initializeSpectrumInfo();
mapa2 spectralPeakPicking(double spectrum[]);
FeatureSet getNoteFeatures(const vectorchords &melodychords);
vector<double> getOnsetTimes();
double *window;
// Plugin params
size_t m_stepSize;
size_t m_blockSize;
float sr;
// Spectrum information
pinfo spectruminfo;
// Local variables for mf0 estimation
vectorchords bestmelodynotes; //, prevmelodynotes;
peaksattvector peaks; //, previouspeaks;
int n_time;
// Params
int algorithm;
int maxpolyphony;
float lowestnote;
float highestnote;
float minnoteduration;
// For selection extents
Vamp::RealTime origin;
// For algorithm based on onset detection
vectorbands spectralbands;
vector<double> previousFrameBands;
bool firstframe;
float onsetsSensitivity,mu;
FeatureList odf;
int resolutiondiff;
};
#endif