diff src/Silvet.cpp @ 303:d8468176339d livemode

More adjustments for live mode, including actually *using* the max frequency we calculated earlier
author Chris Cannam
date Fri, 05 Dec 2014 16:34:24 +0000
parents cac0be04c43c
children f5f3b50b2b9f
line wrap: on
line diff
--- a/src/Silvet.cpp	Tue Dec 02 17:13:10 2014 +0000
+++ b/src/Silvet.cpp	Fri Dec 05 16:34:24 2014 +0000
@@ -382,8 +382,8 @@
 
     float freq = float(27.5 * pow(2.0, (note + pshift) / 12.0));
 
-    cerr << "note = " << note << ", shift = " << shift << ", shiftCount = "
-         << shiftCount << ", obtained freq = " << freq << endl;
+//    cerr << "note = " << note << ", shift = " << shift << ", shiftCount = "
+//         << shiftCount << ", obtained freq = " << freq << endl;
     
     return freq;
 }
@@ -460,7 +460,7 @@
 
     CQParameters params(processingSampleRate,
                         minFreq, 
-                        processingSampleRate / 3,
+                        maxFreq,
                         bpo);
 
     params.q = 0.95; // MIREX code uses 0.8, but it seems 0.9 or lower
@@ -474,8 +474,8 @@
 
     m_cq = new CQSpectrogram(params, CQSpectrogram::InterpolateLinear);
 
-    cerr << "CQ bins = " << m_cq->getTotalBins() << endl;
-    cerr << "CQ min freq = " << m_cq->getMinFrequency() << " (and for confirmation, freq of bin 0 = " << m_cq->getBinFrequency(0) << ")" << endl;
+//    cerr << "CQ bins = " << m_cq->getTotalBins() << endl;
+//    cerr << "CQ min freq = " << m_cq->getMinFrequency() << " (and for confirmation, freq of bin 0 = " << m_cq->getBinFrequency(0) << ")" << endl;
     
     m_colsPerSec = (m_mode == DraftMode ? 25 : 50);
 
@@ -483,8 +483,9 @@
         delete m_postFilter[i];
     }
     m_postFilter.clear();
+    int postFilterLength = 3;
     for (int i = 0; i < getPack(0).templateNoteCount; ++i) {
-        m_postFilter.push_back(new MedianFilter<double>(3));
+        m_postFilter.push_back(new MedianFilter<double>(postFilterLength));
     }
     m_pianoRoll.clear();
     m_inputGains.clear();
@@ -931,7 +932,12 @@
             }
         }
 
-        int v = round(strength * 2);
+        int v;
+        if (m_mode == LiveMode) {
+            v = round(strength * 30);
+        } else {
+            v = round(strength * 2);
+        }
         if (v > partVelocity) {
             partVelocity = v;
         }