Mercurial > hg > silvet
comparison src/Silvet.cpp @ 76:f3bf6503e6c6 timing
Remove debug printouts
author | Chris Cannam |
---|---|
date | Tue, 06 May 2014 11:17:08 +0100 |
parents | 78a7bf247016 |
children | 4422cf710cf4 |
comparison
equal
deleted
inserted
replaced
75:78a7bf247016 | 76:f3bf6503e6c6 |
---|---|
337 data = m_resampler->process(data.data(), data.size()); | 337 data = m_resampler->process(data.data(), data.size()); |
338 } | 338 } |
339 | 339 |
340 Grid cqout = m_cq->process(data); | 340 Grid cqout = m_cq->process(data); |
341 FeatureSet fs = transcribe(cqout); | 341 FeatureSet fs = transcribe(cqout); |
342 /* | 342 |
343 for (int i = 0; i < (int)cqout.size(); ++i) { | 343 for (int i = 0; i < (int)cqout.size(); ++i) { |
344 Feature f; | 344 Feature f; |
345 for (int j = 0; j < (int)cqout[i].size(); ++j) { | 345 for (int j = 0; j < (int)cqout[i].size(); ++j) { |
346 f.values.push_back(float(cqout[i][j])); | 346 f.values.push_back(float(cqout[i][j])); |
347 } | 347 } |
348 fs[m_cqOutputNo].push_back(f); | 348 fs[m_cqOutputNo].push_back(f); |
349 } | 349 } |
350 */ | 350 |
351 return fs; | 351 return fs; |
352 } | 352 } |
353 | 353 |
354 Silvet::FeatureSet | 354 Silvet::FeatureSet |
355 Silvet::getRemainingFeatures() | 355 Silvet::getRemainingFeatures() |
356 { | 356 { |
357 Grid cqout = m_cq->getRemainingBlocks(); | 357 Grid cqout = m_cq->getRemainingBlocks(); |
358 FeatureSet fs = transcribe(cqout); | 358 FeatureSet fs = transcribe(cqout); |
359 /* | 359 |
360 for (int i = 0; i < (int)cqout.size(); ++i) { | 360 for (int i = 0; i < (int)cqout.size(); ++i) { |
361 Feature f; | 361 Feature f; |
362 for (int j = 0; j < (int)cqout[i].size(); ++j) { | 362 for (int j = 0; j < (int)cqout[i].size(); ++j) { |
363 f.values.push_back(float(cqout[i][j])); | 363 f.values.push_back(float(cqout[i][j])); |
364 } | 364 } |
365 fs[m_cqOutputNo].push_back(f); | 365 fs[m_cqOutputNo].push_back(f); |
366 } | 366 } |
367 */ | 367 |
368 return fs; | 368 return fs; |
369 } | 369 } |
370 | 370 |
371 Silvet::FeatureSet | 371 Silvet::FeatureSet |
372 Silvet::transcribe(const Grid &cqout) | 372 Silvet::transcribe(const Grid &cqout) |
373 { | 373 { |
374 Grid filtered = preProcess(cqout); | 374 Grid filtered = preProcess(cqout); |
375 | 375 |
376 FeatureSet fs; | 376 FeatureSet fs; |
377 /* | 377 |
378 for (int i = 0; i < (int)filtered.size(); ++i) { | 378 for (int i = 0; i < (int)filtered.size(); ++i) { |
379 Feature f; | 379 Feature f; |
380 for (int j = 0; j < processingHeight; ++j) { | 380 for (int j = 0; j < processingHeight; ++j) { |
381 f.values.push_back(float(filtered[i][j])); | 381 f.values.push_back(float(filtered[i][j])); |
382 } | 382 } |
383 fs[m_fcqOutputNo].push_back(f); | 383 fs[m_fcqOutputNo].push_back(f); |
384 } | 384 } |
385 */ | |
386 | 385 |
387 int width = filtered.size(); | 386 int width = filtered.size(); |
388 | 387 |
389 int iterations = 12; | 388 int iterations = 12; |
390 | 389 |
525 map<int, double> active; | 524 map<int, double> active; |
526 ValueIndexMap::const_iterator si = strengths.end(); | 525 ValueIndexMap::const_iterator si = strengths.end(); |
527 while (int(active.size()) < polyphony) { | 526 while (int(active.size()) < polyphony) { |
528 --si; | 527 --si; |
529 if (si->first < threshold) break; | 528 if (si->first < threshold) break; |
530 cerr << si->second << " : " << si->first << endl; | 529 // cerr << si->second << " : " << si->first << endl; |
531 active[si->second] = si->first; | 530 active[si->second] = si->first; |
532 if (si == strengths.begin()) break; | 531 if (si == strengths.begin()) break; |
533 } | 532 } |
534 | 533 |
535 // Minimum duration pruning, and conversion to notes. We can only | 534 // Minimum duration pruning, and conversion to notes. We can only |
586 } | 585 } |
587 | 586 |
588 int velocity = maxStrength * 2; | 587 int velocity = maxStrength * 2; |
589 if (velocity > 127) velocity = 127; | 588 if (velocity > 127) velocity = 127; |
590 | 589 |
591 cerr << "Found a genuine note, starting at " << columnDuration * start << " with duration " << columnDuration * duration << endl; | 590 // cerr << "Found a genuine note, starting at " << columnDuration * start << " with duration " << columnDuration * duration << endl; |
592 | 591 |
593 Feature nf; | 592 Feature nf; |
594 nf.hasTimestamp = true; | 593 nf.hasTimestamp = true; |
595 nf.timestamp = RealTime::fromSeconds | 594 nf.timestamp = RealTime::fromSeconds |
596 (columnDuration * (start - postFilterLatency)); | 595 (columnDuration * (start - postFilterLatency)); |