changeset 175:49cd24ef3402 matthiasm-plugin

Merge
author Chris Cannam
date Mon, 02 Nov 2015 12:35:44 +0000
parents 5190d4947ad9 (current diff) 5d4c9c13d3e3 (diff)
children
files
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/NNLSChroma.cpp	Mon Nov 02 12:23:00 2015 +0000
+++ b/NNLSChroma.cpp	Mon Nov 02 12:35:44 2015 +0000
@@ -438,15 +438,21 @@
         float notesum = 0;
         
         consonance.values.push_back(0);
-        for (int iSemitone = 0; iSemitone < 84-24; ++iSemitone) {            
-            notesum += f3.values[iSemitone] * f3.values[iSemitone] * treblewindow[iSemitone] * treblewindow[iSemitone];
-            float tempconsonance = 0;
+        
+        for (int iSemitone = 0; iSemitone < 84; ++iSemitone) {            
+            float tempconsonance = 0;            
+            int sumlength = 1;
             for (int jSemitone = 1; jSemitone < 24; ++jSemitone) {
+                if (iSemitone+jSemitone > 84-1) break;
+                sumlength++;
                 tempconsonance += f3.values[iSemitone+jSemitone] * (consonancepattern[jSemitone]) * treblewindow[iSemitone+jSemitone];
             }
-            consonance.values[0] += (f3.values[iSemitone] * tempconsonance * treblewindow[iSemitone]);
+            notesum += f3.values[iSemitone] * f3.values[iSemitone] * treblewindow[iSemitone] * treblewindow[iSemitone] * sumlength;
+            consonance.values[0] += (f3.values[iSemitone] * tempconsonance * treblewindow[iSemitone]) * sumlength;
         }
+        // cerr << consonance.values[0] << " " << f3.timestamp << " "<< notesum << endl;
         if (notesum > 0) consonance.values[0] /= notesum;
+        
 		
         f4.values = chroma; 
         f5.values = basschroma;
--- a/nnls-chroma.n3	Mon Nov 02 12:23:00 2015 +0000
+++ b/nnls-chroma.n3	Mon Nov 02 12:35:44 2015 +0000
@@ -111,7 +111,7 @@
     vamp:unit           ""  ;
     vamp:default_value   0.7 ;
     vamp:value_names     ();
-
+    .
 plugbase:chordino_param_boostn a  vamp:Parameter ;
     vamp:identifier     "boostn" ;
     dc:title            "Boost likelihood of the N (no chord) label." ;
@@ -134,7 +134,7 @@
     vamp:sample_type      vamp:VariableSampleRate ;
     vamp:sample_rate      21.5332 ;
     vamp:computes_event_type   af:ChordSegment ;
-
+    .
 plugbase:chordino_output_chordnotes a vamp:SparseOutput ;
     vamp:identifier       "chordnotes" ;
     dc:title              "Note Representation of Chord Estimate" ;