Centre for Digital Music, Queen Mary, University of London.
This file copyright 2006-2008 Chris Cannam and QMUL.
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version. See the file
- COPYING included with this distribution for more information.
+ This file is part of vamp-aubio-plugins.
+
+ vamp-aubio is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ vamp-aubio is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with aubio. If not, see <http://www.gnu.org/licenses/>.
*/
m_silence(-70),
m_minioi(4),
m_median(6),
- m_minpitch(27),
+ m_minpitch(32),
m_maxpitch(95),
m_wrapRange(false),
m_avoidLeaps(false),
m_onset = new_fvec(1);
m_pitch = new_fvec(1);
+ reset();
+
+ return true;
+}
+
+void
+Notes::reset()
+{
+ if (m_onsetdet) del_aubio_onset(m_onsetdet);
+ if (m_pitchdet) del_aubio_pitch(m_pitchdet);
+
m_onsetdet = new_aubio_onset
(const_cast<char *>(getAubioNameForOnsetType(m_onsettype)),
- blockSize,
- stepSize,
+ m_blockSize,
+ m_stepSize,
lrintf(m_inputSampleRate));
aubio_onset_set_threshold(m_onsetdet, m_threshold);
m_pitchdet = new_aubio_pitch
(const_cast<char *>(getAubioNameForPitchType(m_pitchtype)),
- blockSize,
- stepSize,
+ m_blockSize,
+ m_stepSize,
lrintf(m_inputSampleRate));
- aubio_pitch_set_unit(m_pitchdet, "freq");
+ aubio_pitch_set_unit(m_pitchdet, const_cast<char *>("freq"));
m_count = 0;
m_delay = Vamp::RealTime::frame2RealTime((4 + m_median) * m_stepSize,
m_currentOnset = Vamp::RealTime::zeroTime;
m_haveCurrent = false;
m_prevPitch = -1;
-
- return true;
-}
-
-void
-Notes::reset()
-{
}
size_t
ParameterDescriptor desc;
desc.identifier = "onsettype";
desc.name = "Onset Detection Function Type";
+ desc.description = "Type of onset detection function to use";
desc.minValue = 0;
desc.maxValue = 7;
desc.defaultValue = (int)OnsetComplex;
desc = ParameterDescriptor();
desc.identifier = "pitchtype";
desc.name = "Pitch Detection Function Type";
+ desc.description = "Type of pitch detection function to use";
desc.minValue = 0;
desc.maxValue = 4;
desc.defaultValue = (int)PitchYinFFT;
desc = ParameterDescriptor();
desc.identifier = "minpitch";
desc.name = "Minimum Pitch";
+ desc.description = "Lowest pitch value to look for";
desc.minValue = 0;
desc.maxValue = 127;
desc.defaultValue = 32;
desc = ParameterDescriptor();
desc.identifier = "maxpitch";
desc.name = "Maximum Pitch";
+ desc.description = "Highest pitch value to look for";
desc.minValue = 0;
desc.maxValue = 127;
desc.defaultValue = 95;
desc = ParameterDescriptor();
desc.identifier = "wraprange";
desc.name = "Fold Higher or Lower Notes into Range";
+ desc.description = "Notes detected outside the range will be transposed to higher or lower octaves";
desc.minValue = 0;
desc.maxValue = 1;
desc.defaultValue = 0;
desc = ParameterDescriptor();
desc.identifier = "avoidleaps";
desc.name = "Avoid Multi-Octave Jumps";
+ desc.description = "Minimize octave jumps by transposing to the octave of the previously detected note";
desc.minValue = 0;
desc.maxValue = 1;
desc.defaultValue = 0;
desc = ParameterDescriptor();
desc.identifier = "peakpickthreshold";
desc.name = "Peak Picker Threshold";
+ desc.description = "Peak picking threshold, the higher the least detection";
desc.minValue = 0;
desc.maxValue = 1;
desc.defaultValue = 0.3;
desc = ParameterDescriptor();
desc.identifier = "silencethreshold";
desc.name = "Silence Threshold";
+ desc.description = "Silence threshold, the higher the least detection";
desc.minValue = -120;
desc.maxValue = 0;
desc.defaultValue = -70;
desc = ParameterDescriptor();
desc.identifier = "minioi";
desc.name = "Minimum Inter-Onset Interval";
+ desc.description = "Time interval below which two consecutive onsets should be merged";
desc.minValue = 0;
desc.maxValue = 40;
desc.defaultValue = 4;
OutputDescriptor d;
d.identifier = "notes";
d.name = "Notes";
+ d.description = "List of notes detected, with their frequency and velocity";
d.unit = "Hz";
d.hasFixedBinCount = true;
Notes::process(const float *const *inputBuffers, Vamp::RealTime timestamp)
{
for (size_t i = 0; i < m_stepSize; ++i) {
- fvec_write_sample(m_ibuf, inputBuffers[0][i], i);
+ fvec_set_sample(m_ibuf, inputBuffers[0][i], i);
}
aubio_onset_do(m_onsetdet, m_ibuf, m_onset);