comparison plugins/Notes.cpp @ 2:76c1a7bd0416

include math.h, add onset timestamps, fix default block and step sizes, switch to onset_complex and pitch_yinfft
author Paul Brossier <piem@piem.org>
date Tue, 16 May 2006 15:43:21 +0000
parents 76761a42d239
children be376e1b36c3
comparison
equal deleted inserted replaced
1:8230b03a8060 2:76c1a7bd0416
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 14
15 */ 15 */
16 16
17 #include <math.h>
17 #include "Notes.h" 18 #include "Notes.h"
18 19
19 using std::string; 20 using std::string;
20 using std::vector; 21 using std::vector;
21 using std::cerr; 22 using std::cerr;
27 m_fftgrain(0), 28 m_fftgrain(0),
28 m_onset(0), 29 m_onset(0),
29 m_pv(0), 30 m_pv(0),
30 m_peakpick(0), 31 m_peakpick(0),
31 m_onsetdet(0), 32 m_onsetdet(0),
32 m_onsettype(aubio_onset_mkl), 33 m_onsettype(aubio_onset_complex),
33 m_pitchdet(0), 34 m_pitchdet(0),
34 m_pitchtype(aubio_pitch_fcomb), 35 m_pitchtype(aubio_pitch_yinfft),
35 m_pitchmode(aubio_pitchm_freq), 36 m_pitchmode(aubio_pitchm_freq),
36 m_threshold(0.3), 37 m_threshold(0.3),
37 m_silence(-90), 38 m_silence(-90),
38 m_median(6) 39 m_median(6)
39 { 40 {
123 } 124 }
124 125
125 size_t 126 size_t
126 Notes::getPreferredStepSize() const 127 Notes::getPreferredStepSize() const
127 { 128 {
128 if (m_onsettype == aubio_onset_energy || 129 return 512;
129 m_onsettype == aubio_onset_hfc) {
130 return 512;
131 } else {
132 return 128;
133 }
134 } 130 }
135 131
136 size_t 132 size_t
137 Notes::getPreferredBlockSize() const 133 Notes::getPreferredBlockSize() const
138 { 134 {
139 return getPreferredStepSize(); 135 return 4*getPreferredStepSize();
140 } 136 }
141 137
142 Notes::ParameterList 138 Notes::ParameterList
143 Notes::getParameterDescriptors() const 139 Notes::getParameterDescriptors() const
144 { 140 {
147 ParameterDescriptor desc; 143 ParameterDescriptor desc;
148 desc.name = "onsettype"; 144 desc.name = "onsettype";
149 desc.description = "Onset Detection Function Type"; 145 desc.description = "Onset Detection Function Type";
150 desc.minValue = 0; 146 desc.minValue = 0;
151 desc.maxValue = 6; 147 desc.maxValue = 6;
152 desc.defaultValue = (int)aubio_onset_mkl; 148 desc.defaultValue = (int)aubio_onset_complex;
153 desc.isQuantized = true; 149 desc.isQuantized = true;
154 desc.quantizeStep = 1; 150 desc.quantizeStep = 1;
155 desc.valueNames.push_back("Energy Based"); 151 desc.valueNames.push_back("Energy Based");
156 desc.valueNames.push_back("Spectral Difference"); 152 desc.valueNames.push_back("Spectral Difference");
157 desc.valueNames.push_back("High-Frequency Content"); 153 desc.valueNames.push_back("High-Frequency Content");
164 desc = ParameterDescriptor(); 160 desc = ParameterDescriptor();
165 desc.name = "pitchtype"; 161 desc.name = "pitchtype";
166 desc.description = "Pitch Detection Function Type"; 162 desc.description = "Pitch Detection Function Type";
167 desc.minValue = 0; 163 desc.minValue = 0;
168 desc.maxValue = 4; 164 desc.maxValue = 4;
169 desc.defaultValue = (int)aubio_pitch_fcomb; 165 desc.defaultValue = (int)aubio_pitch_yinfft;
170 desc.isQuantized = true; 166 desc.isQuantized = true;
171 desc.quantizeStep = 1; 167 desc.quantizeStep = 1;
172 desc.valueNames.push_back("YIN Frequency Estimator"); 168 desc.valueNames.push_back("YIN Frequency Estimator");
173 desc.valueNames.push_back("Spectral Comb"); 169 desc.valueNames.push_back("Spectral Comb");
174 desc.valueNames.push_back("Schmitt"); 170 desc.valueNames.push_back("Schmitt");