Skip to content

Commit f1cec35

Browse files
committed
Merge branch '2.6' into 'main'
2 parents 900aed9 + 1f5948c commit f1cec35

3 files changed

Lines changed: 7 additions & 21 deletions

File tree

lib/qm-dsp/dsp/tempotracking/TempoTrackV2.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ TempoTrackV2::filter_df(d_vec_t &df)
101101
void
102102
TempoTrackV2::calculateBeatPeriod(const vector<double> &df,
103103
vector<double> &beat_period,
104-
vector<double> &tempi,
105104
double inputtempo, bool constraintempo)
106105
{
107106
// to follow matlab.. split into 512 sample frames with a 128 hop size
@@ -168,7 +167,7 @@ TempoTrackV2::calculateBeatPeriod(const vector<double> &df,
168167
}
169168

170169
// now call viterbi decoding function
171-
viterbi_decode(rcfmat,wv,beat_period,tempi);
170+
viterbi_decode(rcfmat,wv,beat_period);
172171
}
173172

174173

@@ -228,7 +227,7 @@ TempoTrackV2::get_rcf(const d_vec_t &dfframe_in, const d_vec_t &wv, d_vec_t &rcf
228227
}
229228

230229
void
231-
TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &beat_period, d_vec_t &tempi)
230+
TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &beat_period)
232231
{
233232
// following Kevin Murphy's Viterbi decoding to get best path of
234233
// beat periods through rfcmat
@@ -316,13 +315,8 @@ TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &
316315
}
317316

318317
i_vec_t bestpath(T);
319-
d_vec_t tmp_vec(Q);
320-
for (int i = 0; i < Q; i++) {
321-
tmp_vec[i] = delta[T-1][i];
322-
}
323-
324318
// find starting point - best beat period for "last" frame
325-
bestpath[T-1] = get_max_ind(tmp_vec);
319+
bestpath[T-1] = get_max_ind(delta[T-1]);
326320

327321
// backtrace through index of maximum values in psi
328322
for (int t=T-2; t>0 ;t--) {
@@ -346,10 +340,6 @@ TempoTrackV2::viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &
346340
for (int i = lastind; i < int(beat_period.size()); i++) {
347341
beat_period[i] = beat_period[lastind];
348342
}
349-
350-
for (int i = 0; i < int(beat_period.size()); i++) {
351-
tempi.push_back((60. * m_rate / m_increment)/beat_period[i]);
352-
}
353343
}
354344

355345
double

lib/qm-dsp/dsp/tempotracking/TempoTrackV2.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@ class TempoTrackV2
3939

4040
// Returned beat periods are given in df increment units; inputtempo and tempi in bpm
4141
void calculateBeatPeriod(const std::vector<double> &df,
42-
std::vector<double> &beatPeriod,
43-
std::vector<double> &tempi) {
44-
calculateBeatPeriod(df, beatPeriod, tempi, 120.0, false);
42+
std::vector<double> &beatPeriod) {
43+
calculateBeatPeriod(df, beatPeriod, 120.0, false);
4544
}
4645

4746
// Returned beat periods are given in df increment units; inputtempo and tempi in bpm
4847
// MEPD 28/11/12 Expose inputtempo and constraintempo parameters
4948
// Note, if inputtempo = 120 and constraintempo = false, then functionality is as it was before
5049
void calculateBeatPeriod(const std::vector<double> &df,
5150
std::vector<double> &beatPeriod,
52-
std::vector<double> &tempi,
5351
double inputtempo, bool constraintempo);
5452

5553
// Returned beat positions are given in df increment units
@@ -80,8 +78,7 @@ class TempoTrackV2
8078
double mean_array(const d_vec_t &dfin, int start, int end);
8179
void filter_df(d_vec_t &df);
8280
void get_rcf(const d_vec_t &dfframe, const d_vec_t &wv, d_vec_t &rcf);
83-
void viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv,
84-
d_vec_t &bp, d_vec_t &tempi);
81+
void viterbi_decode(const d_mat_t &rcfmat, const d_vec_t &wv, d_vec_t &bp);
8582
double get_max_val(const d_vec_t &df);
8683
int get_max_ind(const d_vec_t &df);
8784
void normalise_vec(d_vec_t &df);

src/analyzer/plugins/analyzerqueenmarybeats.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ bool AnalyzerQueenMaryBeats::finalize() {
8484

8585
std::vector<double> df;
8686
std::vector<double> beatPeriod;
87-
std::vector<double> tempi;
8887
const auto required_size = std::max(0, nonZeroCount - 2);
8988
df.reserve(required_size);
9089
beatPeriod.reserve(required_size);
@@ -97,7 +96,7 @@ bool AnalyzerQueenMaryBeats::finalize() {
9796
}
9897

9998
TempoTrackV2 tt(m_sampleRate, m_stepSizeFrames);
100-
tt.calculateBeatPeriod(df, beatPeriod, tempi);
99+
tt.calculateBeatPeriod(df, beatPeriod);
101100

102101
std::vector<double> beats;
103102
tt.calculateBeats(df, beatPeriod, beats);

0 commit comments

Comments
 (0)