annotate src/BTrack.h @ 5:bd2c405d4a06 develop

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