changeset 173:26d054291412

In draft mode, make the CQ transform one octave shorter (bottom octave empty)
author Chris Cannam
date Wed, 21 May 2014 12:15:29 +0100
parents 06d19c847a41
children 237d41a0f69d
files src/Silvet.cpp
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/Silvet.cpp	Wed May 21 12:10:02 2014 +0100
+++ b/src/Silvet.cpp	Wed May 21 12:15:29 2014 +0100
@@ -317,8 +317,16 @@
 	m_resampler = 0;
     }
 
+    double minFreq = 27.5;
+
+    if (!m_hqMode) {
+        // We don't actually return any notes from the bottom octave,
+        // so we can just pad with zeros
+        minFreq *= 2;
+    }
+
     CQParameters params(processingSampleRate,
-                        27.5, 
+                        minFreq, 
                         processingSampleRate / 3,
                         processingBPO);
 
@@ -364,6 +372,16 @@
     }
 
     Grid cqout = m_cq->process(data);
+
+    if (!m_hqMode) {
+        // Our CQ is one octave shorter in draft mode, so pad with
+        // zeros
+        vector<double> octave(m_cq->getBinsPerOctave(), 0.0);
+        for (int i = 0; i < int(cqout.size()); ++i) {
+            cqout[i].insert(cqout[i].end(), octave.begin(), octave.end());
+        }
+    }
+    
     FeatureSet fs = transcribe(cqout);
     return fs;
 }