changeset 58:daf7c92058da

Put spectrogram the "right" way up, add bin labels
author Chris Cannam <c.cannam@qmul.ac.uk>
date Thu, 30 Jan 2014 12:12:16 +0000
parents 65575499e4b9
children a219bab90abe
files Makefile.inc vamp/CQVamp.cpp
diffstat 2 files changed, 23 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.inc	Thu Jan 30 12:11:53 2014 +0000
+++ b/Makefile.inc	Thu Jan 30 12:12:16 2014 +0000
@@ -52,3 +52,10 @@
 depend:
 	makedepend -Y -fMakefile.inc $(SOURCES) $(HEADERS)
 
+# DO NOT DELETE
+
+cpp-qm-dsp/CQKernel.o: cpp-qm-dsp/CQKernel.h
+cpp-qm-dsp/ConstantQ.o: cpp-qm-dsp/ConstantQ.h cpp-qm-dsp/CQKernel.h
+vamp/CQVamp.o: vamp/CQVamp.h cpp-qm-dsp/ConstantQ.h cpp-qm-dsp/CQKernel.h
+vamp/libmain.o: vamp/CQVamp.h
+cpp-qm-dsp/ConstantQ.o: cpp-qm-dsp/CQKernel.h
--- a/vamp/CQVamp.cpp	Thu Jan 30 12:11:53 2014 +0000
+++ b/vamp/CQVamp.cpp	Thu Jan 30 12:12:16 2014 +0000
@@ -6,6 +6,9 @@
 
 #include "base/Pitch.h"
 
+#include <algorithm>
+#include <cstdio>
+
 using std::string;
 using std::vector;
 using std::cerr;
@@ -70,28 +73,7 @@
 CQVamp::getParameterDescriptors() const
 {
     ParameterList list;
-/*
-    ParameterDescriptor desc;
-    desc.identifier = "minfreq";
-    desc.name = "Minimum Frequency";
-    desc.unit = "Hz";
-    desc.description = "Hint for the lowest frequency to be included in the constant-Q transform. The actual frequency range will be an integral number of octaves ending at the highest frequency specified";
-    desc.minValue = 10;
-    desc.maxValue = m_inputSampleRate/2;
-    desc.defaultValue = 46;
-    desc.isQuantized = false;
-    list.push_back(desc);
 
-    desc.identifier = "maxfreq";
-    desc.name = "Maximum Frequency";
-    desc.unit = "Hz";
-    desc.description = "Highest frequency to be included in the constant-Q transform";
-    desc.minValue = 10;
-    desc.maxValue = m_inputSampleRate/2;
-    desc.defaultValue = m_inputSampleRate/2;
-    desc.isQuantized = false;
-    list.push_back(desc);
- */
     ParameterDescriptor desc;
     desc.identifier = "minpitch";
     desc.name = "Minimum Pitch";
@@ -151,14 +133,6 @@
     if (param == "tuning") {
         return m_tuningFrequency;
     }
-/*
-    if (param == "minfreq") {
-        return m_minFrequency;
-    }
-    if (param == "maxfreq") {
-        return m_maxFrequency;
-    }
-*/
     if (param == "bpo") {
         return m_bpo;
     }
@@ -176,11 +150,6 @@
         m_maxMIDIPitch = lrintf(value);
     } else if (param == "tuning") {
         m_tuningFrequency = value;
-/*    if (param == "minfreq") {
-        m_minFrequency = value;
-    } else if (param == "maxfreq") {
-        m_maxFrequency = value;
-*/
     } else  if (param == "bpo") {
         m_bpo = lrintf(value);
     } else {
@@ -251,6 +220,16 @@
     d.description = "Output of constant-Q transform, as a single vector per process block";
     d.hasFixedBinCount = true;
     d.binCount = (m_cq ? m_cq->getTotalBins() : (9 * 24));
+
+    if (m_cq) {
+        char name[20];
+        for (int i = 0; i < d.binCount; ++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;
@@ -308,6 +287,9 @@
 	    }
 	}
 
+        // put low frequencies at the start
+        std::reverse(column.begin(), column.end());
+
 	m_prevFeature = column;
 
 	Feature feature;