comparison src/Silvet.cpp @ 48:1a4cab304d68 preshift

Sum rather than max?
author Chris Cannam
date Mon, 07 Apr 2014 14:36:52 +0100
parents ccb1a437a828
children ce1d88759557
comparison
equal deleted inserted replaced
47:ccb1a437a828 48:1a4cab304d68
24 #include <vector> 24 #include <vector>
25 25
26 #include <cstdio> 26 #include <cstdio>
27 27
28 using std::vector; 28 using std::vector;
29 using std::cout;
29 using std::cerr; 30 using std::cerr;
30 using std::endl; 31 using std::endl;
31 using Vamp::RealTime; 32 using Vamp::RealTime;
32 33
33 static int processingSampleRate = 44100; 34 static int processingSampleRate = 44100;
459 Silvet::postProcess(const vector<double> &pitches) 460 Silvet::postProcess(const vector<double> &pitches)
460 { 461 {
461 vector<double> filtered; 462 vector<double> filtered;
462 463
463 for (int j = 0; j < processingNotes; ++j) { 464 for (int j = 0; j < processingNotes; ++j) {
464 double noteMax = 0.0; 465 double noteSum = 0.0;
465 for (int s = 0; s < processingShifts; ++s) { 466 for (int s = 0; s < processingShifts; ++s) {
466 double val = pitches[j * processingShifts + s]; 467 double val = pitches[j * processingShifts + s];
467 if (val > noteMax) noteMax = val; 468 noteSum += val;
468 } 469 }
469 m_postFilter[j]->push(noteMax); 470 m_postFilter[j]->push(noteSum);
470 filtered.push_back(m_postFilter[j]->get()); 471 filtered.push_back(m_postFilter[j]->get());
471 } 472 }
472 473
473 // Threshold for level and reduce number of candidate pitches 474 // Threshold for level and reduce number of candidate pitches
474 475