diff Chordino.cpp @ 81:4270f3039ab0 matthiasm-plugin

dont remember, sorry
author Matthias Mauch <mail@matthiasmauch.net>
date Mon, 15 Nov 2010 11:01:36 +0900
parents 026a5c0ee2c2
children e5c16976513d
line wrap: on
line diff
--- a/Chordino.cpp	Thu Nov 11 15:11:05 2010 +0900
+++ b/Chordino.cpp	Mon Nov 15 11:01:36 2010 +0900
@@ -374,11 +374,11 @@
 			
         if (some_b_greater_zero) {
             if (m_useNNLS == 0) {
-                for (unsigned iNote = 2; iNote < nNote - 2; iNote += 3) {
+                for (unsigned iNote = nBPS/2 + 2; iNote < nNote - nBPS/2; iNote += nBPS) {
                     currval = 0;
-                    currval += b[iNote + 1 + -1] * 0.5;
-                    currval += b[iNote + 1 +  0] * 1.0; 
-                    currval += b[iNote + 1 +  1] * 0.5; 
+                    for (int iBPS = -nBPS/2; iBPS < nBPS/2+1; ++iBPS) {
+                        currval += b[iNote + iBPS] * (1-abs(iBPS*1.0/(nBPS/2+1)));						
+                    }
                     chroma[iSemitone % 12] += currval * treblewindow[iSemitone];
                     basschroma[iSemitone % 12] += currval * basswindow[iSemitone];
                     iSemitone++;
@@ -390,11 +390,11 @@
                 vector<int> signifIndex;
                 int index=0;
                 sumb /= 84.0;
-                for (unsigned iNote = 2; iNote < nNote - 2; iNote += 3) {
+                for (unsigned iNote = nBPS/2 + 2; iNote < nNote - nBPS/2; iNote += nBPS) {
                     float currval = 0;
-                    currval += b[iNote + 1 + -1];						
-                    currval += b[iNote + 1 +  0];						
-                    currval += b[iNote + 1 +  1];
+                    for (int iBPS = -nBPS/2; iBPS < nBPS/2+1; ++iBPS) {
+                        currval += b[iNote + iBPS]; 
+                    }
                     if (currval > 0) signifIndex.push_back(index);
                     index++;
                 }
@@ -404,6 +404,7 @@
                 int indx[84+1000];
                 int mode;
                 int dictsize = nNote*signifIndex.size();
+                // cerr << "dictsize is " << dictsize << "and values size" << f3.values.size()<< endl;
                 float *curr_dict = new float[dictsize];
                 for (unsigned iNote = 0; iNote < signifIndex.size(); ++iNote) {
                     for (unsigned iBin = 0; iBin < nNote; iBin++) {