annotate src/BTrack.h @ 47:9f45f9dbc6b5

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