Mercurial > hg > qm-dsp
comparison dsp/tempotracking/TempoTrackV2.cpp @ 79:054c384d860d
* Solaris build fixes
author | cannam |
---|---|
date | Mon, 14 Sep 2009 13:01:44 +0000 |
parents | c3cdb404f807 |
children | e5907ae6de17 |
comparison
equal
deleted
inserted
replaced
78:0965d2af5213 | 79:054c384d860d |
---|---|
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 void | 89 void |
90 TempoTrackV2::calculateBeatPeriod(const d_vec_t &df, d_vec_t &beat_period, | 90 TempoTrackV2::calculateBeatPeriod(const vector<double> &df, |
91 d_vec_t &tempi) | 91 vector<double> &beat_period, |
92 vector<double> &tempi) | |
92 { | 93 { |
93 // to follow matlab.. split into 512 sample frames with a 128 hop size | 94 // to follow matlab.. split into 512 sample frames with a 128 hop size |
94 // calculate the acf, | 95 // calculate the acf, |
95 // then the rcf.. and then stick the rcfs as columns of a matrix | 96 // then the rcf.. and then stick the rcfs as columns of a matrix |
96 // then call viterbi decoding with weight vector and transition matrix | 97 // then call viterbi decoding with weight vector and transition matrix |
390 df[i]/= (sum + EPS); | 391 df[i]/= (sum + EPS); |
391 } | 392 } |
392 } | 393 } |
393 | 394 |
394 void | 395 void |
395 TempoTrackV2::calculateBeats(const d_vec_t &df, const d_vec_t &beat_period, | 396 TempoTrackV2::calculateBeats(const vector<double> &df, |
396 d_vec_t &beats) | 397 const vector<double> &beat_period, |
398 vector<double> &beats) | |
397 { | 399 { |
398 if (df.empty() || beat_period.empty()) return; | 400 if (df.empty() || beat_period.empty()) return; |
399 | 401 |
400 d_vec_t cumscore(df.size()); // store cumulative score | 402 d_vec_t cumscore(df.size()); // store cumulative score |
401 i_vec_t backlink(df.size()); // backlink (stores best beat locations at each time instant) | 403 i_vec_t backlink(df.size()); // backlink (stores best beat locations at each time instant) |