Mercurial > hg > silvet
comparison src/Silvet.cpp @ 183:59e3cca75b8d
Add some further parameters to the instrument pack
author | Chris Cannam |
---|---|
date | Fri, 23 May 2014 18:17:59 +0100 |
parents | 825193ef09d2 |
children | 78212f764251 ec19a15bee82 |
comparison
equal
deleted
inserted
replaced
179:825193ef09d2 | 183:59e3cca75b8d |
---|---|
478 | 478 |
479 present[i] = true; | 479 present[i] = true; |
480 | 480 |
481 EM em(&pack, m_hqMode); | 481 EM em(&pack, m_hqMode); |
482 | 482 |
483 em.setPitchSparsity(pack.pitchSparsity); | |
484 | |
483 for (int j = 0; j < iterations; ++j) { | 485 for (int j = 0; j < iterations; ++j) { |
484 em.iterate(filtered.at(i).data()); | 486 em.iterate(filtered.at(i).data()); |
485 } | 487 } |
486 | 488 |
487 const float *pitchDist = em.getPitchDistribution(); | 489 const float *pitchDist = em.getPitchDistribution(); |
631 filtered.push_back(m_postFilter[j]->get()); | 633 filtered.push_back(m_postFilter[j]->get()); |
632 } | 634 } |
633 | 635 |
634 // Threshold for level and reduce number of candidate pitches | 636 // Threshold for level and reduce number of candidate pitches |
635 | 637 |
636 int polyphony = 5; | |
637 | |
638 //!!! make this a parameter (was 4.8, try adjusting, compare levels against matlab code) | |
639 double threshold = 6; | |
640 // double threshold = 4.8; | |
641 | |
642 typedef std::multimap<double, int> ValueIndexMap; | 638 typedef std::multimap<double, int> ValueIndexMap; |
643 | 639 |
644 ValueIndexMap strengths; | 640 ValueIndexMap strengths; |
645 | 641 |
646 for (int j = 0; j < pack.templateNoteCount; ++j) { | 642 for (int j = 0; j < pack.templateNoteCount; ++j) { |
647 double strength = filtered[j]; | 643 double strength = filtered[j]; |
648 if (strength < threshold) continue; | 644 if (strength < pack.levelThreshold) continue; |
649 strengths.insert(ValueIndexMap::value_type(strength, j)); | 645 strengths.insert(ValueIndexMap::value_type(strength, j)); |
650 } | 646 } |
651 | 647 |
652 ValueIndexMap::const_iterator si = strengths.end(); | 648 ValueIndexMap::const_iterator si = strengths.end(); |
653 | 649 |
654 map<int, double> active; | 650 map<int, double> active; |
655 map<int, int> activeShifts; | 651 map<int, int> activeShifts; |
656 | 652 |
657 while (int(active.size()) < polyphony && si != strengths.begin()) { | 653 while (int(active.size()) < pack.maxPolyphony && si != strengths.begin()) { |
658 | 654 |
659 --si; | 655 --si; |
660 | 656 |
661 double strength = si->first; | 657 double strength = si->first; |
662 int j = si->second; | 658 int j = si->second; |