# HG changeset patch # User Chris Cannam # Date 1446467744 0 # Node ID 49cd24ef34022375ca0a3b923e70c10c7651e931 # Parent 5190d4947ad917bcd8e58556a173040f3d18b64a# Parent 5d4c9c13d3e3b83294b6cb8c03c69d2a209f2e6d Merge diff -r 5190d4947ad9 -r 49cd24ef3402 NNLSChroma.cpp --- 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; diff -r 5190d4947ad9 -r 49cd24ef3402 nnls-chroma.n3 --- 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" ;