Ardour  9.0-pre0-582-g084a23a80d
minibpm.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  MiniBPM
5  A fixed-tempo BPM estimator for music audio
6  Copyright 2012 Particular Programs Ltd.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version. See the file
12  COPYING included with this distribution for more information.
13 
14  Alternatively, if you have a valid commercial licence for MiniBPM
15  obtained by agreement with the copyright holders, you may
16  redistribute and/or modify it under the terms described in that
17  licence.
18 
19  If you wish to distribute code using MiniBPM under terms other
20  than those of the GNU General Public License, you must obtain a
21  valid commercial licence before doing so.
22 */
23 
24 #ifndef _BQ_MINI_BPM_H_
25 #define _BQ_MINI_BPM_H_
26 
27 #include <vector>
28 
29 namespace breakfastquay {
30 
45 class MiniBPM
46 {
47 public:
48  MiniBPM(float sampleRate);
50 
54  void setBPMRange(double min, double max);
55  void getBPMRange(double &min, double &max) const;
56 
61  void setBeatsPerBar(int bpb);
62  int getBeatsPerBar() const;
63 
75  double estimateTempoOfSamples(const float *samples, int nsamples);
76 
82  void process(const float *samples, int nsamples);
83 
90  double estimateTempo();
91 
98  std::vector<double> getTempoCandidates() const;
99 
105  void reset();
106 
107 private:
108  class D;
109  D *m_d;
110 };
111 
112 }
113 
114 #endif
int getBeatsPerBar() const
void setBPMRange(double min, double max)
std::vector< double > getTempoCandidates() const
MiniBPM(float sampleRate)
void setBeatsPerBar(int bpb)
void process(const float *samples, int nsamples)
double estimateTempoOfSamples(const float *samples, int nsamples)
void getBPMRange(double &min, double &max) const