changeset 51:782ca0d9ff3e

More outputs
author Chris Cannam
date Mon, 07 Apr 2014 17:07:36 +0100
parents 9b17bbd16a5f
children 22553e7b2a63 9e2d1f6cd43a
files .hgsubstate src/Silvet.cpp src/Silvet.h
diffstat 3 files changed, 58 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Mon Apr 07 16:21:57 2014 +0100
+++ b/.hgsubstate	Mon Apr 07 17:07:36 2014 +0100
@@ -1,1 +1,1 @@
-3393a2898a1db0d97fe63f32a28f82001454171e constant-q-cpp
+08f90c46ac6ba30d9e96517a20dba5be70b66d56 constant-q-cpp
--- a/src/Silvet.cpp	Mon Apr 07 16:21:57 2014 +0100
+++ b/src/Silvet.cpp	Mon Apr 07 17:07:36 2014 +0100
@@ -165,9 +165,9 @@
     OutputList list;
 
     OutputDescriptor d;
-    d.identifier = "transcription";
-    d.name = "Transcription";
-    d.description = ""; //!!!
+    d.identifier = "notes";
+    d.name = "Note transcription";
+    d.description = "Overall note transcription across all instruments";
     d.unit = "Hz";
     d.hasFixedBinCount = true;
     d.binCount = 2;
@@ -176,14 +176,37 @@
     d.hasKnownExtents = false;
     d.isQuantized = false;
     d.sampleType = OutputDescriptor::VariableSampleRate;
-    d.sampleRate = m_inputSampleRate / (m_cq ? m_cq->getColumnHop() : 256);
+    d.sampleRate = m_inputSampleRate / (m_cq ? m_cq->getColumnHop() : 62);
     d.hasDuration = true;
     m_notesOutputNo = list.size();
     list.push_back(d);
 
+    d.identifier = "cq";
+    d.name = "Raw constant-Q";
+    d.description = "Unfiltered constant-Q time-frequency distribution";
+    d.unit = "";
+    d.hasFixedBinCount = true;
+    d.binCount = processingHeight + 55;
+    d.binNames.clear();
+    if (m_cq) {
+        char name[20];
+        for (int i = 0; i < processingHeight + 55; ++i) {
+            float freq = m_cq->getBinFrequency(i);
+            sprintf(name, "%.1f Hz", freq);
+            d.binNames.push_back(name);
+        }
+    }
+    d.hasKnownExtents = false;
+    d.isQuantized = false;
+    d.sampleType = OutputDescriptor::FixedSampleRate;
+    d.sampleRate = m_inputSampleRate / (m_cq ? m_cq->getColumnHop() : 62);
+    d.hasDuration = false;
+    m_cqOutputNo = list.size();
+    list.push_back(d);
+
     d.identifier = "inputgrid";
-    d.name = "Filtered time-frequency grid";
-    d.description = "The pre-processed constant-Q time-frequency distribution used as input to the PLCA step";
+    d.name = "Filtered constant-Q";
+    d.description = "Filtered constant-Q time-frequency distribution used as input to the PLCA step";
     d.unit = "";
     d.hasFixedBinCount = true;
     d.binCount = processingHeight;
@@ -201,12 +224,12 @@
     d.sampleType = OutputDescriptor::FixedSampleRate;
     d.sampleRate = 25;
     d.hasDuration = false;
-    m_cqOutputNo = list.size();
+    m_fcqOutputNo = list.size();
     list.push_back(d);
 
-    d.identifier = "pitchdistribution";
-    d.name = "Pitch distribution";
-    d.description = "The estimated pitch contribution matrix";
+    d.identifier = "pitches";
+    d.name = "Pitch activation";
+    d.description = "Estimated pitch activation matrix";
     d.unit = "";
     d.hasFixedBinCount = true;
     d.binCount = processingNotes;
@@ -313,14 +336,34 @@
     }
 
     Grid cqout = m_cq->process(data);
-    return transcribe(cqout);
+    FeatureSet fs = transcribe(cqout);
+
+    for (int i = 0; i < (int)cqout.size(); ++i) {
+        Feature f;
+        for (int j = 0; j < (int)cqout[i].size(); ++j) {
+            f.values.push_back(float(cqout[i][j]));
+        }
+        fs[m_cqOutputNo].push_back(f);
+    }
+
+    return fs;
 }
 
 Silvet::FeatureSet
 Silvet::getRemainingFeatures()
 {
     Grid cqout = m_cq->getRemainingBlocks();
-    return transcribe(cqout);
+    FeatureSet fs = transcribe(cqout);
+
+    for (int i = 0; i < (int)cqout.size(); ++i) {
+        Feature f;
+        for (int j = 0; j < (int)cqout[i].size(); ++j) {
+            f.values.push_back(float(cqout[i][j]));
+        }
+        fs[m_cqOutputNo].push_back(f);
+    }
+
+    return fs;
 }
 
 Silvet::FeatureSet
@@ -335,7 +378,7 @@
         for (int j = 0; j < processingHeight; ++j) {
             f.values.push_back(float(filtered[i][j]));
         }
-        fs[m_cqOutputNo].push_back(f);
+        fs[m_fcqOutputNo].push_back(f);
     }
 
     int width = filtered.size();
--- a/src/Silvet.h	Mon Apr 07 16:21:57 2014 +0100
+++ b/src/Silvet.h	Mon Apr 07 17:07:36 2014 +0100
@@ -91,6 +91,7 @@
 
     mutable int m_notesOutputNo;
     mutable int m_cqOutputNo;
+    mutable int m_fcqOutputNo;
     mutable int m_pitchOutputNo;
 };