Mercurial > hg > silvet
comparison src/Silvet.cpp @ 341:705d807ca2ca livemode
Replace Draft with Live mode
author | Chris Cannam |
---|---|
date | Mon, 06 Jul 2015 09:15:09 +0100 |
parents | d25e4aee73d7 |
children | 460cabb27bf7 |
comparison
equal
deleted
inserted
replaced
340:1bfde6dba499 | 341:705d807ca2ca |
---|---|
145 | 145 |
146 ParameterDescriptor desc; | 146 ParameterDescriptor desc; |
147 desc.identifier = "mode"; | 147 desc.identifier = "mode"; |
148 desc.name = "Processing mode"; | 148 desc.name = "Processing mode"; |
149 desc.unit = ""; | 149 desc.unit = ""; |
150 desc.description = "Sets the tradeoff of processing speed against transcription quality. Draft mode is tuned in favour of overall speed; Live mode is tuned in favour of lower latency; while Intensive mode (the default) will almost always produce the best results."; | 150 desc.description = "Sets the tradeoff of processing speed against transcription quality. Live mode is much faster and detects notes with relatively low latency; Intensive mode (the default) is slower but will almost always produce better results."; |
151 desc.minValue = 0; | 151 desc.minValue = 0; |
152 desc.maxValue = 2; | 152 desc.maxValue = 2; |
153 desc.defaultValue = int(defaultMode); | 153 desc.defaultValue = int(defaultMode); |
154 desc.isQuantized = true; | 154 desc.isQuantized = true; |
155 desc.quantizeStep = 1; | 155 desc.quantizeStep = 1; |
156 desc.valueNames.push_back("Draft (faster)"); | 156 desc.valueNames.push_back("Live (faster and lower latency)"); |
157 desc.valueNames.push_back("Intensive (higher quality)"); | 157 desc.valueNames.push_back("Intensive (higher quality)"); |
158 desc.valueNames.push_back("Live (lower latency)"); | |
159 list.push_back(desc); | 158 list.push_back(desc); |
160 | 159 |
161 desc.identifier = "instrument"; | 160 desc.identifier = "instrument"; |
162 desc.name = "Instrument"; | 161 desc.name = "Instrument"; |
163 desc.unit = ""; | 162 desc.unit = ""; |
514 maxFreq *= powf(2.0, -1.0 / 30.0); | 513 maxFreq *= powf(2.0, -1.0 / 30.0); |
515 } | 514 } |
516 | 515 |
517 double minFreq = 27.5; | 516 double minFreq = 27.5; |
518 | 517 |
519 if (m_mode != HighQualityMode) { | 518 if (m_mode == LiveMode) { |
520 // We don't actually return any notes from the bottom octave, | 519 // We don't actually return any notes from the bottom octave, |
521 // so we can just pad with zeros | 520 // so we can just pad with zeros |
522 minFreq *= 2; | 521 minFreq *= 2; |
523 } | 522 } |
524 | 523 |
541 m_cq = new CQSpectrogram(params, CQSpectrogram::InterpolateLinear); | 540 m_cq = new CQSpectrogram(params, CQSpectrogram::InterpolateLinear); |
542 | 541 |
543 // cerr << "CQ bins = " << m_cq->getTotalBins() << endl; | 542 // cerr << "CQ bins = " << m_cq->getTotalBins() << endl; |
544 // cerr << "CQ min freq = " << m_cq->getMinFrequency() << " (and for confirmation, freq of bin 0 = " << m_cq->getBinFrequency(0) << ")" << endl; | 543 // cerr << "CQ min freq = " << m_cq->getMinFrequency() << " (and for confirmation, freq of bin 0 = " << m_cq->getBinFrequency(0) << ")" << endl; |
545 | 544 |
546 m_colsPerSec = (m_mode == DraftMode ? 25 : 50); | 545 m_colsPerSec = 50; |
547 | 546 |
548 for (int i = 0; i < (int)m_postFilter.size(); ++i) { | 547 for (int i = 0; i < (int)m_postFilter.size(); ++i) { |
549 delete m_postFilter[i]; | 548 delete m_postFilter[i]; |
550 } | 549 } |
551 m_postFilter.clear(); | 550 m_postFilter.clear(); |
911 vector<double> outCol(pack.templateHeight); | 910 vector<double> outCol(pack.templateHeight); |
912 | 911 |
913 // In HQ mode, the CQ returns 600 bins and we ignore the | 912 // In HQ mode, the CQ returns 600 bins and we ignore the |
914 // lowest 55 of them (assuming binsPerSemitone == 5). | 913 // lowest 55 of them (assuming binsPerSemitone == 5). |
915 // | 914 // |
916 // In draft and live mode the CQ is an octave shorter, | 915 // In live mode the CQ is an octave shorter, returning 540 |
917 // returning 540 bins or equivalent, so we instead pad | 916 // bins or equivalent, so we instead pad them with an |
918 // them with an additional 5 or equivalent zeros. | 917 // additional 5 or equivalent zeros. |
919 // | 918 // |
920 // We also need to reverse the column as we go, since the | 919 // We also need to reverse the column as we go, since the |
921 // raw CQ has the high frequencies first and we need it | 920 // raw CQ has the high frequencies first and we need it |
922 // the other way around. | 921 // the other way around. |
923 | 922 |