diff src/FeatureExtractor.h @ 176:50bf5c5bca34 refactors

Add minimum and maximum frequency parameters to FeatureExtractor
author Chris Cannam
date Fri, 13 Feb 2015 15:18:47 +0000
parents cdbee79699b0
children 1440773da492
line wrap: on
line diff
--- a/src/FeatureExtractor.h	Fri Feb 06 18:47:27 2015 +0000
+++ b/src/FeatureExtractor.h	Fri Feb 13 15:18:47 2015 +0000
@@ -49,7 +49,9 @@
             sampleRate(rate_),
             useChromaFrequencyMap(false),
             fftSize(fftSize_),
-            referenceFrequency(440.0)
+            referenceFrequency(440.0),
+            minFrequency(0.),
+            maxFrequency(rate_/2.)
         {}
 
         /** Sample rate of audio */
@@ -66,6 +68,12 @@
 
         /** Frequency of concert A */
         double referenceFrequency;
+
+        /** Minimum frequency cutoff to include in feature */
+        double minFrequency;
+
+        /** Maximum frequency cutoff to include in feature */
+        double maxFrequency;
     };
 
     /**
@@ -138,7 +146,12 @@
      *  linearly for bins 0-34 (0 to 732Hz), and logarithmically for
      *  the remaining bins (midi notes 79 to 127, bins 35 to 83),
      *  where all energy above note 127 is mapped into the final
-     *  bin. */
+     *  bin.
+     * 
+     *  If a bin's frequency is outside the minFrequency->maxFrequency
+     *  range, it will be mapped to a target bin of -1 and should be
+     *  discarded.
+     */
     std::vector<int> m_freqMap;
 
     /** The size of a returned feature. */