Mercurial > hg > btrack
comparison src/BTrack.h @ 12:c87f667abd68 master v0.9.0
flow: Merged <release> 'v0.9.0' to <master> ('master').
author | Adam <adamstark.uk@gmail.com> |
---|---|
date | Tue, 21 Jan 2014 01:45:36 +0000 |
parents | 46971d477183 |
children | 18fc3c248436 bb3803edaa17 |
comparison
equal
deleted
inserted
replaced
2:6e3f541ef1a8 | 12:c87f667abd68 |
---|---|
1 //======================================================================= | |
2 /** @file BTrack.h | |
3 * @brief BTrack - a real-time beat tracker | |
4 * @author Adam Stark | |
5 * @copyright Copyright (C) 2008-2014 Queen Mary University of London | |
6 * | |
7 * This program is free software: you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation, either version 3 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 */ | |
20 //======================================================================= | |
21 | |
22 #ifndef __BTRACK_H | |
23 #define __BTRACK_H | |
24 | |
25 //#include "fftw3.h" | |
26 | |
27 class BTrack { | |
28 | |
29 public: | |
30 BTrack(); // constructor | |
31 ~BTrack(); // destructor | |
32 | |
33 void initialise(int fsize); | |
34 void process(float df_sample); | |
35 void plotdfbuffer(); | |
36 void updatecumscore(float df_sample); | |
37 void predictbeat(); | |
38 void dfconvert(); | |
39 void calcTempo(); | |
40 void adapt_thresh(float x[],int N); | |
41 float mean_array(float array[],int start,int end); | |
42 void normalise(float array[],int N); | |
43 void acf_bal(float df_thresh[]); | |
44 void getrcfoutput(); | |
45 void settempo(float tempo); | |
46 void fixtempo(float tempo); | |
47 void unfixtempo(); | |
48 | |
49 int playbeat; | |
50 float cscoreval; | |
51 float est_tempo; | |
52 | |
53 private: | |
54 | |
55 // buffers | |
56 float *dfbuffer; // to hold detection function | |
57 float df512[512]; // to hold resampled detection function | |
58 float *cumscore; // to hold cumulative score | |
59 | |
60 float acf[512]; // to hold autocorrelation function | |
61 | |
62 float wv[128]; // to hold weighting vector | |
63 | |
64 float rcf[128]; // to hold comb filter output | |
65 float t_obs[41]; // to hold tempo version of comb filter output | |
66 | |
67 float delta[41]; // to hold final tempo candidate array | |
68 float prev_delta[41]; // previous delta | |
69 float prev_delta_fix[41]; // fixed tempo version of previous delta | |
70 | |
71 float t_tmat[41][41]; // transition matrix | |
72 | |
73 | |
74 // parameters | |
75 float tightness; | |
76 float alpha; | |
77 float bperiod; | |
78 float tempo; | |
79 | |
80 | |
81 float p_fact; | |
82 | |
83 | |
84 // | |
85 int m0; // indicates when the next point to predict the next beat is | |
86 int beat; | |
87 | |
88 int dfbuffer_size; | |
89 | |
90 | |
91 int framesize; | |
92 | |
93 | |
94 int tempofix; | |
95 | |
96 | |
97 }; | |
98 | |
99 #endif |