Mercurial > hg > qm-dsp
comparison dsp/tempotracking/TempoTrackV2.cpp @ 55:7fe29d8a7eaf
* Various fixes related to the bar estimator code
author | cannam |
---|---|
date | Tue, 10 Feb 2009 16:37:11 +0000 |
parents | 5bec06ecc88a |
children | a0f987c06bec |
comparison
equal
deleted
inserted
replaced
54:5bec06ecc88a | 55:7fe29d8a7eaf |
---|---|
324 for (uint j=0; j<step; j++) | 324 for (uint j=0; j<step; j++) |
325 { | 325 { |
326 lastind = i*step+j; | 326 lastind = i*step+j; |
327 beat_period[lastind] = bestpath[i]; | 327 beat_period[lastind] = bestpath[i]; |
328 } | 328 } |
329 std::cerr << "bestpath[" << i << "] = " << bestpath[i] << " (used for beat_periods " << i*step << " to " << i*step+step-1 << ")" << std::endl; | |
329 } | 330 } |
330 | 331 |
331 //fill in the last values... | 332 //fill in the last values... |
332 for (uint i=lastind; i<beat_period.size(); i++) | 333 for (uint i=lastind; i<beat_period.size(); i++) |
333 { | 334 { |
433 double vv = get_max_val(scorecands); | 434 double vv = get_max_val(scorecands); |
434 int xx = get_max_ind(scorecands); | 435 int xx = get_max_ind(scorecands); |
435 | 436 |
436 cumscore[i] = alpha*vv + (1.-alpha)*localscore[i]; | 437 cumscore[i] = alpha*vv + (1.-alpha)*localscore[i]; |
437 backlink[i] = i+prange_min+xx; | 438 backlink[i] = i+prange_min+xx; |
439 | |
440 std::cerr << "backlink[" << i << "] <= " << backlink[i] << std::endl; | |
438 } | 441 } |
439 | 442 |
440 // STARTING POINT, I.E. LAST BEAT.. PICK A STRONG POINT IN cumscore VECTOR | 443 // STARTING POINT, I.E. LAST BEAT.. PICK A STRONG POINT IN cumscore VECTOR |
441 d_vec_t tmp_vec; | 444 d_vec_t tmp_vec; |
442 for (uint i=cumscore.size() - beat_period[beat_period.size()-1] ; i<cumscore.size(); i++) | 445 for (uint i=cumscore.size() - beat_period[beat_period.size()-1] ; i<cumscore.size(); i++) |
448 | 451 |
449 // USE BACKLINK TO GET EACH NEW BEAT (TOWARDS THE BEGINNING OF THE FILE) | 452 // USE BACKLINK TO GET EACH NEW BEAT (TOWARDS THE BEGINNING OF THE FILE) |
450 // BACKTRACKING FROM THE END TO THE BEGINNING.. MAKING SURE NOT TO GO BEFORE SAMPLE 0 | 453 // BACKTRACKING FROM THE END TO THE BEGINNING.. MAKING SURE NOT TO GO BEFORE SAMPLE 0 |
451 i_vec_t ibeats; | 454 i_vec_t ibeats; |
452 ibeats.push_back(startpoint); | 455 ibeats.push_back(startpoint); |
456 std::cerr << "startpoint = " << startpoint << std::endl; | |
453 while (backlink[ibeats.back()] > 0) | 457 while (backlink[ibeats.back()] > 0) |
454 { | 458 { |
459 std::cerr << "backlink[" << ibeats.back() << "] = " << backlink[ibeats.back()] << std::endl; | |
455 ibeats.push_back(backlink[ibeats.back()]); | 460 ibeats.push_back(backlink[ibeats.back()]); |
456 } | 461 } |
457 | 462 |
458 // REVERSE SEQUENCE OF IBEATS AND STORE AS BEATS | 463 // REVERSE SEQUENCE OF IBEATS AND STORE AS BEATS |
459 for (uint i=0; i<ibeats.size(); i++) | 464 for (uint i=0; i<ibeats.size(); i++) |