1
Plugin Development / coding...
« on: March 23, 2009, 17:50:45 »
hi,
can you please look at my codes in the process call, am i doing the right coding.
VocalRangeAnalyzerPlugin::FeatureSet
VocalRangeAnalyzerPlugin::process(const float *const *inputBuffers,
Vamp::RealTime timestamp)
{
FeatureSet returnFeatures;
if (m_stepSize == 0) {
std::cerr << "VocalRangeAnalyzerPlugin::process: Plugin not initialised" << std::endl;
return returnFeatures;
}
for (size_t i = 0; i < m_stepSize; ++i) {
for (size_t j = 0; j < m_channelCount; ++j) {
fvec_write_sample(m_ibuf, inputBuffers[j], j, i);
}
}
calculate();
if (minFreq >= 80 && maxFreq <= 310){
feature.label = "bass";}
else if(minFreq >= 100 && maxFreq <= 440){
feature.label ="baritone";}
else if(minFreq >=130 && maxFreq <= 500){
feature.label = "tenor";}
else if(minFreq >= 160 && maxFreq <= 650){
feature.label = "alto";}
else if(minFreq >= 210 && maxFreq <= 900){
feature.label = "mezzo-soprano";}
else if(minFreq >= 270 && maxFreq <= 1100){
feature.label = "soprano";}
Feature feature;
feature.hasTimestamp = true;
feature.timestamp = m_currentOnset +
RealTime::frame2RealTime(i * m_stepSize, m_inputSampleRate);
feature.hasDuration = true;
feature.duration = offTime - m_currentOnset;
feature.values.push_back(freq);
returnFeatures[0].push_back(feature);
return returnFeatures;
}
void
VocalRangeAnalyzerPlugin::calculate()
{
float freq = aubio_pitchdetection(m_pitchdet, m_ibuf);
for(int i=0; i<m_stepSize; i++)
{
if(freq < minFreq){
minFreq = freq;
}
else
if(freq > maxFreq){
maxFreq = freq;
}
isFirstTime(false);
}
}
//consider all has been initialized
do i miss something, there's no error, i got a dll file but then it is not running in sonic v.
please help. thanks.
hazel
can you please look at my codes in the process call, am i doing the right coding.
VocalRangeAnalyzerPlugin::FeatureSet
VocalRangeAnalyzerPlugin::process(const float *const *inputBuffers,
Vamp::RealTime timestamp)
{
FeatureSet returnFeatures;
if (m_stepSize == 0) {
std::cerr << "VocalRangeAnalyzerPlugin::process: Plugin not initialised" << std::endl;
return returnFeatures;
}
for (size_t i = 0; i < m_stepSize; ++i) {
for (size_t j = 0; j < m_channelCount; ++j) {
fvec_write_sample(m_ibuf, inputBuffers[j], j, i);
}
}
calculate();
if (minFreq >= 80 && maxFreq <= 310){
feature.label = "bass";}
else if(minFreq >= 100 && maxFreq <= 440){
feature.label ="baritone";}
else if(minFreq >=130 && maxFreq <= 500){
feature.label = "tenor";}
else if(minFreq >= 160 && maxFreq <= 650){
feature.label = "alto";}
else if(minFreq >= 210 && maxFreq <= 900){
feature.label = "mezzo-soprano";}
else if(minFreq >= 270 && maxFreq <= 1100){
feature.label = "soprano";}
Feature feature;
feature.hasTimestamp = true;
feature.timestamp = m_currentOnset +
RealTime::frame2RealTime(i * m_stepSize, m_inputSampleRate);
feature.hasDuration = true;
feature.duration = offTime - m_currentOnset;
feature.values.push_back(freq);
returnFeatures[0].push_back(feature);
return returnFeatures;
}
void
VocalRangeAnalyzerPlugin::calculate()
{
float freq = aubio_pitchdetection(m_pitchdet, m_ibuf);
for(int i=0; i<m_stepSize; i++)
{
if(freq < minFreq){
minFreq = freq;
}
else
if(freq > maxFreq){
maxFreq = freq;
}
isFirstTime(false);
}
}
//consider all has been initialized
do i miss something, there's no error, i got a dll file but then it is not running in sonic v.
please help. thanks.
hazel