annotate src/BTrack.h @ 39:a34bd41313aa

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