changeset 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
files data/include/templates.h src/LiveInstruments.cpp src/Silvet.cpp testdata/evaluation/run.sh
diffstat 4 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/data/include/templates.h	Tue Dec 02 17:13:10 2014 +0000
+++ b/data/include/templates.h	Fri Dec 05 16:34:24 2014 +0000
@@ -6,7 +6,7 @@
 /* note: intended to parse as both C and C++ */
 
 #define SILVET_TEMPLATE_COUNT      14   /* Number of instruments */
-#define SILVET_TEMPLATE_NOTE_COUNT 88   /* Number of notes per instrument */ 
+#define SILVET_TEMPLATE_NOTE_COUNT 88   /* Number of notes per instrument */
 #define SILVET_TEMPLATE_HEIGHT     545  /* Frequency bins per template */
 #define SILVET_TEMPLATE_MAX_SHIFT  2    /* Zeros at either end of template */ 
 #define SILVET_TEMPLATE_SIZE       549  /* Height + 2 * max shift space */ 
--- a/src/LiveInstruments.cpp	Tue Dec 02 17:13:10 2014 +0000
+++ b/src/LiveInstruments.cpp	Fri Dec 05 16:34:24 2014 +0000
@@ -26,7 +26,7 @@
 {
     vector<InstrumentPack::Templates> templates;
 
-            cerr << "LiveAdapter: reduced template height is " << SILVET_TEMPLATE_HEIGHT/5 << endl;
+//            cerr << "LiveAdapter: reduced template height is " << SILVET_TEMPLATE_HEIGHT/5 << endl;
             
     for (vector<InstrumentPack::Templates>::const_iterator i =
 	     original.templates.begin();
@@ -77,7 +77,7 @@
     live.maxPolyphony = original.maxPolyphony;
     live.pitchSparsity = original.pitchSparsity;
     live.sourceSparsity = original.sourceSparsity;
-    live.levelThreshold = original.levelThreshold/10; //!!! but why?
+    live.levelThreshold = original.levelThreshold / 20;
 
     return live;
 }
--- 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;
         }
--- a/testdata/evaluation/run.sh	Tue Dec 02 17:13:10 2014 +0000
+++ b/testdata/evaluation/run.sh	Fri Dec 05 16:34:24 2014 +0000
@@ -79,6 +79,8 @@
     
     piece=`basename \`dirname "$infile" \``
     arrangement=`basename "$infile" .wav`
+
+    # Change this to the processing mode you want to test (e.g. 0 for draft)
     mode=1
 
     echo