Mercurial > hg > nnls-chroma
comparison chromamethods.cpp @ 122:21181297da99 monophonicness
replacing unsigned/size_t iterators by int and casting others to int
author | matthiasm |
---|---|
date | Fri, 15 Apr 2011 11:31:37 +0000 |
parents | 7a8956e903e1 |
children | b115fa66c695 |
comparison
equal
deleted
inserted
replaced
121:072327bbb1a2 | 122:21181297da99 |
---|---|
148 for (int iFFT = 1; iFFT < nFFT; ++iFFT) { | 148 for (int iFFT = 1; iFFT < nFFT; ++iFFT) { |
149 // find frequency stretch where the oversampled vector can be non-zero (i.e. in a window of width fft_width around the current frequency) | 149 // find frequency stretch where the oversampled vector can be non-zero (i.e. in a window of width fft_width around the current frequency) |
150 int curr_start = oversampling * iFFT - oversampling; | 150 int curr_start = oversampling * iFFT - oversampling; |
151 int curr_end = oversampling * iFFT + oversampling; // don't know if I should add "+1" here | 151 int curr_end = oversampling * iFFT + oversampling; // don't know if I should add "+1" here |
152 // cerr << oversampled_f[curr_start] << " " << fft_f[iFFT] << " " << oversampled_f[curr_end] << endl; | 152 // cerr << oversampled_f[curr_start] << " " << fft_f[iFFT] << " " << oversampled_f[curr_end] << endl; |
153 for (unsigned iCQ = 0; iCQ < cq_f.size(); ++iCQ) { | 153 for (int iCQ = 0; iCQ < (int)cq_f.size(); ++iCQ) { |
154 outmatrix[iFFT + nFFT * iCQ] = 0; | 154 outmatrix[iFFT + nFFT * iCQ] = 0; |
155 if (cq_f[iCQ] * pow(2.0, 0.084) + fft_width > fft_f[iFFT] && cq_f[iCQ] * pow(2.0, -0.084 * 2) - fft_width < fft_f[iFFT]) { // within a generous neighbourhood | 155 if (cq_f[iCQ] * pow(2.0, 0.084) + fft_width > fft_f[iFFT] && cq_f[iCQ] * pow(2.0, -0.084 * 2) - fft_width < fft_f[iFFT]) { // within a generous neighbourhood |
156 for (int iOS = curr_start; iOS < curr_end; ++iOS) { | 156 for (int iOS = curr_start; iOS < curr_end; ++iOS) { |
157 cq_activation = pitchCospuls(oversampled_f[iOS],cq_f[iCQ],binspersemitone*12); | 157 cq_activation = pitchCospuls(oversampled_f[iOS],cq_f[iCQ],binspersemitone*12); |
158 // cerr << oversampled_f[iOS] << " " << cq_f[iCQ] << " " << cq_activation << endl; | 158 // cerr << oversampled_f[iOS] << " " << cq_f[iCQ] << " " << cq_activation << endl; |
368 {"Ab","","Bb","Cb","C","Db","","Eb","","F","Gb","G"}, | 368 {"Ab","","Bb","Cb","C","Db","","Eb","","F","Gb","G"}, |
369 {"1","","2","b3","3","4","","5","","6","b7","7"} | 369 {"1","","2","b3","3","4","","5","","6","b7","7"} |
370 }; | 370 }; |
371 | 371 |
372 bool hasExternalDictinoary = true; | 372 bool hasExternalDictinoary = true; |
373 | 373 int ppathsize = static_cast<int>(ppath.size()); |
374 for (size_t i = 0; i < ppath.size(); ++i) { | 374 for (int i = 0; i < ppathsize; ++i) { |
375 chordDictFilename = ppath[i] + "/" + chordDictBase; | 375 chordDictFilename = ppath[i] + "/" + chordDictBase; |
376 cerr << "Looking for chord.dict in " << chordDictFilename << "..." ; | 376 cerr << "Looking for chord.dict in " << chordDictFilename << "..." ; |
377 fstream fin; | 377 fstream fin; |
378 fin.open(chordDictFilename.c_str(),ios::in); | 378 fin.open(chordDictFilename.c_str(),ios::in); |
379 if( fin.is_open() ) | 379 if( fin.is_open() ) |
380 { | 380 { |
381 fin.close(); | 381 fin.close(); |
382 cerr << " success." << endl; | 382 cerr << " success." << endl; |
383 break; | 383 break; |
384 } else { | 384 } else { |
385 if (i+1 < ppath.size()) cerr << " (not found yet) ..." << endl; | 385 if (i+1 < ppathsize) cerr << " (not found yet) ..." << endl; |
386 else { | 386 else { |
387 cerr << "* WARNING: failed to find chord dictionary, using default chord dictionary." << endl; | 387 cerr << "* WARNING: failed to find chord dictionary, using default chord dictionary." << endl; |
388 hasExternalDictinoary = false; | 388 hasExternalDictinoary = false; |
389 } | 389 } |
390 } | 390 } |
485 } | 485 } |
486 | 486 |
487 | 487 |
488 // N type | 488 // N type |
489 loadedChordNames.push_back("N"); | 489 loadedChordNames.push_back("N"); |
490 for (unsigned kSemitone = 0; kSemitone < 12; kSemitone++) loadedChordDict.push_back(0.5); | 490 for (int kSemitone = 0; kSemitone < 12; kSemitone++) loadedChordDict.push_back(0.5); |
491 for (unsigned kSemitone = 0; kSemitone < 12; kSemitone++) loadedChordDict.push_back(1.0); | 491 for (int kSemitone = 0; kSemitone < 12; kSemitone++) loadedChordDict.push_back(1.0); |
492 vector<int> tempchordvector; | 492 vector<int> tempchordvector; |
493 m_chordnotes->push_back(tempchordvector); | 493 m_chordnotes->push_back(tempchordvector); |
494 float exponent = 2.0; | 494 float exponent = 2.0; |
495 // float m_boostN = 1.1; | 495 // float m_boostN = 1.1; |
496 // cerr << " N BOOST : " << boostN << endl << endl; | 496 // cerr << " N BOOST : " << boostN << endl << endl; |