# HG changeset patch # User Adam # Date 1390864291 0 # Node ID deb49a2590f34f5067028466a3a80517e43551fd # Parent 92ee4ace9d46846e30ae5c77e4716486a7ab21b4 Updated README, commented more code, added a Vamp plug-in diff -r 92ee4ace9d46 -r deb49a2590f3 .hgignore --- a/.hgignore Sat Jan 25 18:17:51 2014 +0000 +++ b/.hgignore Mon Jan 27 23:11:31 2014 +0000 @@ -5,4 +5,7 @@ xcuserdata .DS_Store +*.o +*.dylib + *.xcworkspace \ No newline at end of file diff -r 92ee4ace9d46 -r deb49a2590f3 BTrack.Doxyfile --- a/BTrack.Doxyfile Sat Jan 25 18:17:51 2014 +0000 +++ b/BTrack.Doxyfile Mon Jan 27 23:11:31 2014 +0000 @@ -675,7 +675,8 @@ # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = src +INPUT = src \ + doc # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff -r 92ee4ace9d46 -r deb49a2590f3 README.md --- a/README.md Sat Jan 25 18:17:51 2014 +0000 +++ b/README.md Mon Jan 27 23:11:31 2014 +0000 @@ -30,4 +30,64 @@ License ------- -BTrack is made available under the GNU General Public License, version 3. Please see the included LICENSE.txt for more details. \ No newline at end of file +BTrack is made available under the GNU General Public License, version 3. Please see the included LICENSE.txt for more details. + +Usage - C++ +----------- + +**STEP 1** + +Include the BTrack header file as follows: + + #include "BTrack.h" + +**STEP 2** + +Instantiate the algorithm by one of the following: + + // to use the default 512 hop size and 1024 frame size + BTrack b; + +or: + + // to specify a hop size (e.g. 512) and have a frame size of 2 x the hop size + BTrack b(512); + +or: + + // to specify both the hop size and frame size + BTrack b(512,1024); + +**STEP 3.1 - Audio Input** + +In the processing loop, fill a double precision array with one frame of audio samples (as determined in step 2): + + double *frame; + + // ! + // do something here to fill the frame with audio samples + // ! + +and then call: + + b.processAudioFrame(frame); + +and to check for beats, simply call: + + if (b.beatDueInCurrentFrame()) + { + // do something on the beat + } + +**STEP 3.2 - Onset Detection Function Input** + +The algorithm can process onset detection function samples. Given a double precision onset detection function sample called 'newSamples', at each step, call: + + b.processOnsetDetectionFunctionSample(newSample); + +and then check for beats with: + + if (b.beatDueInCurrentFrame()) + { + // do something on the beat + } diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/_b_track_8cpp.html --- a/doc/html/_b_track_8cpp.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/_b_track_8cpp.html Mon Jan 27 23:11:31 2014 +0000 @@ -67,7 +67,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -103,7 +103,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/_b_track_8h.html --- a/doc/html/_b_track_8h.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/_b_track_8h.html Mon Jan 27 23:11:31 2014 +0000 @@ -67,7 +67,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -110,7 +110,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/_b_track_8h_source.html --- a/doc/html/_b_track_8h_source.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/_b_track_8h_source.html Mon Jan 27 23:11:31 2014 +0000 @@ -67,7 +67,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -197,7 +197,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/_onset_detection_function_8cpp.html --- a/doc/html/_onset_detection_function_8cpp.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/_onset_detection_function_8cpp.html Mon Jan 27 23:11:31 2014 +0000 @@ -67,7 +67,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -101,7 +101,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/_onset_detection_function_8h.html --- a/doc/html/_onset_detection_function_8h.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/_onset_detection_function_8h.html Mon Jan 27 23:11:31 2014 +0000 @@ -67,7 +67,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -167,7 +167,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/_onset_detection_function_8h_source.html --- a/doc/html/_onset_detection_function_8h_source.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/_onset_detection_function_8h_source.html Mon Jan 27 23:11:31 2014 +0000 @@ -67,7 +67,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -119,84 +119,85 @@
51  TukeyWindow
52 };
53 
- -
55 {
-
56 public:
-
57 
-
64  OnsetDetectionFunction(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType);
-
65 
- -
68 
-
70  void initialise(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType);
-
71 
-
73  double calculateOnsetDetectionFunctionSample(double *buffer);
-
74 
-
76  void setOnsetDetectionFunctionType(int onsetDetectionFunctionType_);
-
77 
-
78 private:
-
79 
-
81  void performFFT();
-
82 
-
83  //=======================================================================
-
85  double energyEnvelope();
-
86 
-
88  double energyDifference();
+
54 //=======================================================================
+ +
57 {
+
58 public:
+
59 
+
66  OnsetDetectionFunction(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType);
+
67 
+ +
70 
+
77  void initialise(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType);
+
78 
+
83  double calculateOnsetDetectionFunctionSample(double *buffer);
+
84 
+
88  void setOnsetDetectionFunctionType(int onsetDetectionFunctionType_);
89 
-
91  double spectralDifference();
-
92 
-
94  double spectralDifferenceHWR();
-
95 
-
97  double phaseDeviation();
+
90 private:
+
91 
+
93  void performFFT();
+
94 
+
95  //=======================================================================
+
97  double energyEnvelope();
98 
-
100  double complexSpectralDifference();
+
100  double energyDifference();
101 
-
103  double complexSpectralDifferenceHWR();
+
103  double spectralDifference();
104 
-
106  double highFrequencyContent();
+
106  double spectralDifferenceHWR();
107 
-
109  double highFrequencySpectralDifference();
+
109  double phaseDeviation();
110 
-
112  double highFrequencySpectralDifferenceHWR();
-
113 
-
114  //=======================================================================
-
116  void calculateRectangularWindow();
-
117 
-
119  void calculateHanningWindow();
-
120 
-
122  void calclulateHammingWindow();
-
123 
-
125  void calculateBlackmanWindow();
-
126 
-
128  void calculateTukeyWindow();
-
129 
-
130  //=======================================================================
-
132  double princarg(double phaseVal);
-
133 
-
134 
-
135  double pi;
-
137  int frameSize;
-
138  int hopSize;
-
139  int onsetDetectionFunctionType;
-
141  fftw_plan p;
-
142  fftw_complex *complexIn;
-
143  fftw_complex *complexOut;
-
145  int initialised;
-
147  double *frame;
-
148  double *window;
-
150  double prevEnergySum;
-
152  double *magSpec;
-
153  double *prevMagSpec;
-
155  double *phase;
-
156  double *prevPhase;
-
157  double *prevPhase2;
-
159 };
-
160 
-
161 
-
162 #endif
+
112  double complexSpectralDifference();
+
113 
+
115  double complexSpectralDifferenceHWR();
+
116 
+
118  double highFrequencyContent();
+
119 
+
121  double highFrequencySpectralDifference();
+
122 
+
124  double highFrequencySpectralDifferenceHWR();
+
125 
+
126  //=======================================================================
+
128  void calculateRectangularWindow();
+
129 
+
131  void calculateHanningWindow();
+
132 
+
134  void calclulateHammingWindow();
+
135 
+
137  void calculateBlackmanWindow();
+
138 
+
140  void calculateTukeyWindow();
+
141 
+
142  //=======================================================================
+
147  double princarg(double phaseVal);
+
148 
+
149 
+
150  double pi;
+
152  int frameSize;
+
153  int hopSize;
+
154  int onsetDetectionFunctionType;
+
156  fftw_plan p;
+
157  fftw_complex *complexIn;
+
158  fftw_complex *complexOut;
+
160  int initialised;
+
162  double *frame;
+
163  double *window;
+
165  double prevEnergySum;
+
167  double *magSpec;
+
168  double *prevMagSpec;
+
170  double *phase;
+
171  double *prevPhase;
+
172  double *prevPhase2;
+
174 };
+
175 
+
176 
+
177 #endif
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/annotated.html --- a/doc/html/annotated.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/annotated.html Mon Jan 27 23:11:31 2014 +0000 @@ -69,7 +69,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -92,7 +92,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/class_b_track-members.html --- a/doc/html/class_b_track-members.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/class_b_track-members.html Mon Jan 27 23:11:31 2014 +0000 @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -103,7 +103,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/class_b_track.html --- a/doc/html/class_b_track.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/class_b_track.html Mon Jan 27 23:11:31 2014 +0000 @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -480,7 +480,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/class_onset_detection_function-members.html --- a/doc/html/class_onset_detection_function-members.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/class_onset_detection_function-members.html Mon Jan 27 23:11:31 2014 +0000 @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -94,7 +94,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/class_onset_detection_function.html --- a/doc/html/class_onset_detection_function.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/class_onset_detection_function.html Mon Jan 27 23:11:31 2014 +0000 @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -86,6 +86,8 @@
OnsetDetectionFunction Class Reference
+ +

#include <OnsetDetectionFunction.h>

@@ -100,7 +102,9 @@

Public Member Functions

void setOnsetDetectionFunctionType (int onsetDetectionFunctionType_)
 
-

Constructor & Destructor Documentation

+

Detailed Description

+

A class for calculating onset detection functions.

+

Constructor & Destructor Documentation

@@ -179,7 +183,14 @@
-

process input frame and calculate detection function sample

+

Process input frame and calculate detection function sample

+
Parameters
+ + +
buffera pointer to an array containing the audio samples to be processed
+
+
+
Returns
the onset detection function sample
@@ -219,6 +230,15 @@

Initialisation Function

+
Parameters
+ + + + + +
hopSize_the hop size in audio samples
frameSize_the frame size in audio samples
onsetDetectionFunctionType_the type of onset detection function to use - (see OnsetDetectionFunctionType)
windowTypethe type of window to use (see WindowType)
+
+
@@ -235,7 +255,13 @@
-

set the detection function type

+

Set the detection function type

+
Parameters
+ + +
onsetDetectionFunctionType_the type of onset detection function to use - (see OnsetDetectionFunctionType)
+
+
@@ -246,7 +272,7 @@ diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/classes.html --- a/doc/html/classes.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/classes.html Mon Jan 27 23:11:31 2014 +0000 @@ -69,7 +69,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -96,7 +96,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html --- a/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html Mon Jan 27 23:11:31 2014 +0000 @@ -61,7 +61,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -99,7 +99,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/files.html --- a/doc/html/files.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/files.html Mon Jan 27 23:11:31 2014 +0000 @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -94,7 +94,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/functions.html --- a/doc/html/functions.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/functions.html Mon Jan 27 23:11:31 2014 +0000 @@ -75,7 +75,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -138,7 +138,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/functions_func.html --- a/doc/html/functions_func.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/functions_func.html Mon Jan 27 23:11:31 2014 +0000 @@ -75,7 +75,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -138,7 +138,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/globals.html --- a/doc/html/globals.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/globals.html Mon Jan 27 23:11:31 2014 +0000 @@ -74,7 +74,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -95,7 +95,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/globals_enum.html --- a/doc/html/globals_enum.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/globals_enum.html Mon Jan 27 23:11:31 2014 +0000 @@ -74,7 +74,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -95,7 +95,7 @@
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/index.html --- a/doc/html/index.html Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/index.html Mon Jan 27 23:11:31 2014 +0000 @@ -3,7 +3,7 @@ -BTrack - A Real-Time Beat Tracker: Main Page +BTrack - A Real-Time Beat Tracker: BTrack - A Real-Time Beat Tracker @@ -62,7 +62,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Classes Files Functions Enumerations + All Classes Files Functions Enumerations Pages
@@ -73,13 +73,54 @@
-
BTrack - A Real-Time Beat Tracker Documentation
+
BTrack - A Real-Time Beat Tracker
-
+

A real-time beat tracker, implemented in C++.

+

Written by Adam Stark, Matthew Davies and Mark Plumbley.

+

License

+

BTrack is made available under the GNU General Public License, version 3. Please see the included LICENSE.txt for more details.

+

Usage - C++

+

STEP 1

+

Include the BTrack header file as follows:

+
    #include "BTrack.h"
+

STEP 2

+

Instantiate the algorithm by one of the following:

+
// to use the default 512 hop size and 1024 frame size
+BTrack b; 
+

or:

+
// to specify a hop size (e.g. 512) and have a frame size of 2 x the hop size
+BTrack b(512); 
+

or:

+
// to specify both the hop size and frame size
+BTrack b(512,1024);
+

STEP 3.1 - Audio Input

+

In the processing loop, fill a double precision array with one frame of audio samples (as determined in step 2):

+
double *frame; 
+
+// !
+// do something here to fill the frame with audio samples
+// !
+

and then call:

+
b.processAudioFrame(frame);
+

and to check for beats, simply call:

+
if (b.beatDueInCurrentFrame())
+{
+    // do something on the beat
+}
+

STEP 3.2 - Onset Detection Function Input

+

The algorithm can process onset detection function samples. Given a double precision onset detection function sample called 'newSamples', at each step, call:

+
b.processOnsetDetectionFunctionSample(newSample);
+

and then check for beats with:

+
if (b.beatDueInCurrentFrame())
+{
+    // do something on the beat
+}
+

For any questions, please email Adam Stark (email at http://www.adamstark.co.uk).

+
diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/search/all_62.js --- a/doc/html/search/all_62.js Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/search/all_62.js Mon Jan 27 23:11:31 2014 +0000 @@ -3,5 +3,6 @@ ['beatdueincurrentframe',['beatDueInCurrentFrame',['../class_b_track.html#ac92eaea0e42dd18c79de10bf852d7f4a',1,'BTrack']]], ['btrack',['BTrack',['../class_b_track.html',1,'BTrack'],['../class_b_track.html#a243ac408666ce0301fecd9b0a2a6f307',1,'BTrack::BTrack()'],['../class_b_track.html#ac4dbda7c90ce1a3080def2d5da875171',1,'BTrack::BTrack(int hopSize_)'],['../class_b_track.html#afce9e207a2f6ff71d96125dee16797de',1,'BTrack::BTrack(int hopSize_, int frameSize_)']]], ['btrack_2ecpp',['BTrack.cpp',['../_b_track_8cpp.html',1,'']]], - ['btrack_2eh',['BTrack.h',['../_b_track_8h.html',1,'']]] + ['btrack_2eh',['BTrack.h',['../_b_track_8h.html',1,'']]], + ['btrack_20_2d_20a_20real_2dtime_20beat_20tracker',['BTrack - A Real-Time Beat Tracker',['../index.html',1,'']]] ]; diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/search/pages_62.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/html/search/pages_62.html Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/search/pages_62.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/html/search/pages_62.js Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,4 @@ +var searchData= +[ + ['btrack_20_2d_20a_20real_2dtime_20beat_20tracker',['BTrack - A Real-Time Beat Tracker',['../index.html',1,'']]] +]; diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/search/pages_67.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/html/search/pages_67.html Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/search/pages_67.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/html/search/pages_67.js Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,4 @@ +var searchData= +[ + ['gist_20_2d_20a_20real_2dtime_20audio_20analaysis_20library',['Gist - A Real-Time Audio Analaysis Library',['../index.html',1,'']]] +]; diff -r 92ee4ace9d46 -r deb49a2590f3 doc/html/search/search.js --- a/doc/html/search/search.js Sat Jan 25 18:17:51 2014 +0000 +++ b/doc/html/search/search.js Mon Jan 27 23:11:31 2014 +0000 @@ -11,7 +11,8 @@ 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011101101000001100100000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }; var indexSectionNames = @@ -20,7 +21,8 @@ 1: "classes", 2: "files", 3: "functions", - 4: "enums" + 4: "enums", + 5: "pages" }; function convertToId(search) diff -r 92ee4ace9d46 -r deb49a2590f3 doc/mainpage.dox --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/mainpage.dox Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,75 @@ +/** +* \mainpage BTrack - A Real-Time Beat Tracker +* +* A real-time beat tracker, implemented in C++. +* +* Written by Adam Stark, Matthew Davies and Mark Plumbley. +* +* License +* ------- +* +* BTrack is made available under the GNU General Public License, version 3. Please see the included LICENSE.txt for more details. +* +* Usage - C++ +* ----------- +* +* **STEP 1** +* +* Include the BTrack header file as follows: +* +* #include "BTrack.h" +* +* **STEP 2** +* +* Instantiate the algorithm by one of the following: +* +* +* // to use the default 512 hop size and 1024 frame size +* BTrack b; +* +* or: +* +* // to specify a hop size (e.g. 512) and have a frame size of 2 x the hop size +* BTrack b(512); +* +* or: +* +* // to specify both the hop size and frame size +* BTrack b(512,1024); +* +* **STEP 3.1 - Audio Input** +* +* In the processing loop, fill a double precision array with one frame of audio samples (as determined in step 2): +* +* double *frame; +* +* // ! +* // do something here to fill the frame with audio samples +* // ! +* +* and then call: +* +* b.processAudioFrame(frame); +* +* and to check for beats, simply call: +* +* if (b.beatDueInCurrentFrame()) +* { +* // do something on the beat +* } +* +* **STEP 3.2 - Onset Detection Function Input** +* +* The algorithm can process onset detection function samples. Given a double precision onset detection function sample called 'newSamples', at each step, call: +* +* b.processOnsetDetectionFunctionSample(newSample); +* +* and then check for beats with: +* +* if (b.beatDueInCurrentFrame()) +* { +* // do something on the beat +* } +* +* For any questions, please email Adam Stark (email at http://www.adamstark.co.uk). +*/ \ No newline at end of file diff -r 92ee4ace9d46 -r deb49a2590f3 modules-and-plug-ins/python-module/btrack_python_module.cpp --- a/modules-and-plug-ins/python-module/btrack_python_module.cpp Sat Jan 25 18:17:51 2014 +0000 +++ b/modules-and-plug-ins/python-module/btrack_python_module.cpp Mon Jan 27 23:11:31 2014 +0000 @@ -5,7 +5,112 @@ #include //======================================================================= -static PyObject * btrack_onsetdf(PyObject *dummy, PyObject *args) +static PyObject * btrack_trackBeats(PyObject *dummy, PyObject *args) +{ + PyObject *arg1=NULL; + PyObject *arr1=NULL; + + if (!PyArg_ParseTuple(args, "O", &arg1)) + { + return NULL; + } + + arr1 = PyArray_FROM_OTF(arg1, NPY_DOUBLE, NPY_IN_ARRAY); + if (arr1 == NULL) + { + return NULL; + } + + + + ////////// GET INPUT DATA /////////////////// + + // get data as array + double* data = (double*) PyArray_DATA(arr1); + + // get array size + long signal_length = PyArray_Size((PyObject*)arr1); + + + ////////// BEGIN PROCESS /////////////////// + int hopSize = 512; + int frameSize = 1024; + + int numframes; + double buffer[hopSize]; // buffer to hold one hopsize worth of audio samples + + + // get number of audio frames, given the hop size and signal length + numframes = (int) floor(((double) signal_length) / ((double) hopSize)); + + + BTrack b(hopSize,frameSize); + + + double beats[5000]; + int beatnum = 0; + + /////////////////////////////////////////// + //////// Begin Processing Loop //////////// + + for (int i=0;i < numframes;i++) + { + // add new samples to frame + for (int n = 0;n < hopSize;n++) + { + buffer[n] = data[(i*hopSize)+n]; + } + + // process the current audio frame + b.processAudioFrame(buffer); + + // if a beat is currently scheduled + if (b.beatDueInCurrentFrame()) + { + beats[beatnum] = BTrack::getBeatTimeInSeconds(i,hopSize,44100); + beatnum = beatnum + 1; + } + + } + + ///////// End Processing Loop ///////////// + /////////////////////////////////////////// + + + ////////// END PROCESS /////////////////// + + double beats_out[beatnum]; // create output array + + // copy beats into output array + for (int i = 0;i < beatnum;i++) + { + beats_out[i] = beats[i]; + } + + + + ////////// CREATE ARRAY AND RETURN IT /////////////////// + int nd=1; + npy_intp m= beatnum; + //double fArray[5] = {0,1,2,3,4}; + + PyObject* c=PyArray_SimpleNew(nd, &m, NPY_DOUBLE); + + void *arr_data = PyArray_DATA((PyArrayObject*)c); + + memcpy(arr_data, beats_out, PyArray_ITEMSIZE((PyArrayObject*) c) * m); + + + Py_DECREF(arr1); + Py_INCREF(Py_None); + //return Py_None; + + return (PyObject *)c; +} + + +//======================================================================= +static PyObject * btrack_calculateOnsetDF(PyObject *dummy, PyObject *args) { PyObject *arg1=NULL; PyObject *arr1=NULL; @@ -67,14 +172,12 @@ /////////////////////////////////////////// - ////////// END PROCESS /////////////////// - - + ////////// CREATE ARRAY AND RETURN IT /////////////////// int nd=1; npy_intp m= numframes; - //double fArray[5] = {0,1,2,3,4}; + PyObject* c=PyArray_SimpleNew(nd, &m, NPY_DOUBLE); @@ -90,112 +193,9 @@ return (PyObject *)c; } -//======================================================================= -static PyObject * btrack_btrack(PyObject *dummy, PyObject *args) -{ - PyObject *arg1=NULL; - PyObject *arr1=NULL; - - if (!PyArg_ParseTuple(args, "O", &arg1)) - { - return NULL; - } - - arr1 = PyArray_FROM_OTF(arg1, NPY_DOUBLE, NPY_IN_ARRAY); - if (arr1 == NULL) - { - return NULL; - } - - - - ////////// GET INPUT DATA /////////////////// - - // get data as array - double* data = (double*) PyArray_DATA(arr1); - - // get array size - long signal_length = PyArray_Size((PyObject*)arr1); - - - ////////// BEGIN PROCESS /////////////////// - int hopSize = 512; - int frameSize = 1024; - - int numframes; - double buffer[hopSize]; // buffer to hold one hopsize worth of audio samples - - - // get number of audio frames, given the hop size and signal length - numframes = (int) floor(((double) signal_length) / ((double) hopSize)); - - - BTrack b(hopSize,frameSize); - - - double beats[5000]; - int beatnum = 0; - - /////////////////////////////////////////// - //////// Begin Processing Loop //////////// - - for (int i=0;i < numframes;i++) - { - // add new samples to frame - for (int n = 0;n < hopSize;n++) - { - buffer[n] = data[(i*hopSize)+n]; - } - - // process the current audio frame - b.processAudioFrame(buffer); - - // if a beat is currently scheduled - if (b.beatDueInCurrentFrame()) - { - beats[beatnum] = BTrack::getBeatTimeInSeconds(i,hopSize,44100); - beatnum = beatnum + 1; - } - - } - - ///////// End Processing Loop ///////////// - /////////////////////////////////////////// - - - ////////// END PROCESS /////////////////// - - double beats_out[beatnum]; // create output array - - // copy beats into output array - for (int i = 0;i < beatnum;i++) - { - beats_out[i] = beats[i]; - } - - - - ////////// CREATE ARRAY AND RETURN IT /////////////////// - int nd=1; - npy_intp m= beatnum; - //double fArray[5] = {0,1,2,3,4}; - - PyObject* c=PyArray_SimpleNew(nd, &m, NPY_DOUBLE); - - void *arr_data = PyArray_DATA((PyArrayObject*)c); - - memcpy(arr_data, beats_out, PyArray_ITEMSIZE((PyArrayObject*) c) * m); - - - Py_DECREF(arr1); - Py_INCREF(Py_None); - //return Py_None; - - return (PyObject *)c; -} //======================================================================= -static PyObject * btrack_btrack_df(PyObject *dummy, PyObject *args) +static PyObject * btrack_trackBeatsFromOnsetDF(PyObject *dummy, PyObject *args) { PyObject *arg1=NULL; PyObject *arr1=NULL; @@ -283,12 +283,11 @@ return (PyObject *)c; } - //======================================================================= static PyMethodDef btrack_methods[] = { - { "onsetdf",btrack_onsetdf,METH_VARARGS,"onset detection function"}, - { "btrack",btrack_btrack,METH_VARARGS,"beat tracker"}, - { "btrack_df",btrack_btrack_df,METH_VARARGS,"beat tracker with detection function input"}, + { "calculateOnsetDF",btrack_calculateOnsetDF,METH_VARARGS,"Calculate the onset detection function"}, + { "trackBeats",btrack_trackBeats,METH_VARARGS,"Track beats from audio"}, + { "trackBeatsFromOnsetDF",btrack_trackBeatsFromOnsetDF,METH_VARARGS,"Track beats from an onset detection function"}, {NULL, NULL, 0, NULL} /* Sentinel */ }; diff -r 92ee4ace9d46 -r deb49a2590f3 modules-and-plug-ins/vamp-plugin/BTrackVamp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules-and-plug-ins/vamp-plugin/BTrackVamp.cpp Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,243 @@ + +// This is a skeleton file for use in creating your own plugin +// libraries. Replace BTrackVamp and myPlugin throughout with the name +// of your first plugin class, and fill in the gaps as appropriate. + + +#include "BTrackVamp.h" + + +BTrackVamp::BTrackVamp(float inputSampleRate) : + Plugin(inputSampleRate) + // Also be sure to set your plugin parameters (presumably stored + // in member variables) to their default values here -- the host + // will not do that for you +{ +} + +BTrackVamp::~BTrackVamp() +{ +} + +string +BTrackVamp::getIdentifier() const +{ + return "btrack-vamp"; +} + +string +BTrackVamp::getName() const +{ + return "BTrack"; +} + +string +BTrackVamp::getDescription() const +{ + // Return something helpful here! + return "A Real-Time Beat Tracker"; +} + +string +BTrackVamp::getMaker() const +{ + // Your name here + return "Adam Stark, Matthew Davies and Mark Plumbley"; +} + +int +BTrackVamp::getPluginVersion() const +{ + // Increment this each time you release a version that behaves + // differently from the previous one + return 1; +} + +string +BTrackVamp::getCopyright() const +{ + // This function is not ideally named. It does not necessarily + // need to say who made the plugin -- getMaker does that -- but it + // should indicate the terms under which it is distributed. For + // example, "Copyright (year). All Rights Reserved", or "GPL" + return ""; +} + +BTrackVamp::InputDomain +BTrackVamp::getInputDomain() const +{ + return TimeDomain; +} + +size_t +BTrackVamp::getPreferredBlockSize() const +{ + return 1024; // 0 means "I can handle any block size" +} + +size_t +BTrackVamp::getPreferredStepSize() const +{ + return 512; // 0 means "anything sensible"; in practice this + // means the same as the block size for TimeDomain + // plugins, or half of it for FrequencyDomain plugins +} + +size_t +BTrackVamp::getMinChannelCount() const +{ + return 1; +} + +size_t +BTrackVamp::getMaxChannelCount() const +{ + return 1; +} + +BTrackVamp::ParameterList +BTrackVamp::getParameterDescriptors() const +{ + ParameterList list; + + // If the plugin has no adjustable parameters, return an empty + // list here (and there's no need to provide implementations of + // getParameter and setParameter in that case either). + + // Note that it is your responsibility to make sure the parameters + // start off having their default values (e.g. in the constructor + // above). The host needs to know the default value so it can do + // things like provide a "reset to default" function, but it will + // not explicitly set your parameters to their defaults for you if + // they have not changed in the mean time. + +// ParameterDescriptor d; +// d.identifier = "parameter"; +// d.name = "Some Parameter"; +// d.description = ""; +// d.unit = ""; +// d.minValue = 0; +// d.maxValue = 10; +// d.defaultValue = 5; +// d.isQuantized = false; +// list.push_back(d); + + return list; +} + +float +BTrackVamp::getParameter(string identifier) const +{ + if (identifier == "parameter") { + return 5; // return the ACTUAL current value of your parameter here! + } + return 0; +} + +void +BTrackVamp::setParameter(string identifier, float value) +{ + if (identifier == "parameter") { + // set the actual value of your parameter + } +} + +BTrackVamp::ProgramList +BTrackVamp::getPrograms() const +{ + ProgramList list; + + // If you have no programs, return an empty list (or simply don't + // implement this function or getCurrentProgram/selectProgram) + + return list; +} + +string +BTrackVamp::getCurrentProgram() const +{ + return ""; // no programs +} + +void +BTrackVamp::selectProgram(string name) +{ +} + +BTrackVamp::OutputList +BTrackVamp::getOutputDescriptors() const +{ + OutputList list; + + // See OutputDescriptor documentation for the possibilities here. + // Every plugin must have at least one output. + + OutputDescriptor d; + d.identifier = "beats"; + d.name = "Beats"; + d.description = "Beat locations"; + d.unit = ""; + d.hasFixedBinCount = true; + d.binCount = 0; + d.hasKnownExtents = false; + d.isQuantized = false; + d.sampleType = OutputDescriptor::VariableSampleRate; + d.sampleRate = m_inputSampleRate; + list.push_back(d); + + return list; +} + +bool +BTrackVamp::initialise(size_t channels, size_t stepSize, size_t blockSize) +{ + if (channels < getMinChannelCount() || + channels > getMaxChannelCount()) return false; + + + m_stepSize = stepSize; + m_blockSize = blockSize; + + // Real initialisation work goes here! + + return true; +} + +void +BTrackVamp::reset() +{ + // Clear buffers, reset stored values, etc +} + +BTrackVamp::FeatureSet +BTrackVamp::process(const float *const *inputBuffers, Vamp::RealTime timestamp) +{ + double frame[m_blockSize]; + + for (int i = 0;i < m_blockSize;i++) + { + frame[i] = (double) inputBuffers[0][i]; + } + + b.processAudioFrame(frame); + + FeatureSet featureSet; + + if (b.beatDueInCurrentFrame()) + { + Feature beat; + beat.hasTimestamp = true; + beat.timestamp = timestamp - Vamp::RealTime::frame2RealTime(m_stepSize, int(m_inputSampleRate + 0.5)); + featureSet[0].push_back(beat); + } + + // Do actual work! + return featureSet; +} + +BTrackVamp::FeatureSet +BTrackVamp::getRemainingFeatures() +{ + return FeatureSet(); +} + diff -r 92ee4ace9d46 -r deb49a2590f3 modules-and-plug-ins/vamp-plugin/BTrackVamp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules-and-plug-ins/vamp-plugin/BTrackVamp.h Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,65 @@ + +// This is a skeleton file for use in creating your own plugin +// libraries. Replace MyPlugin and myPlugin throughout with the name +// of your first plugin class, and fill in the gaps as appropriate. + + +// Remember to use a different guard symbol in each header! +#ifndef _BTRACK_VAMP_H_ +#define _BTRACK_VAMP_H_ + +#include +#include "../../src/BTrack.h" + +using std::string; + + +class BTrackVamp : public Vamp::Plugin +{ +public: + BTrackVamp(float inputSampleRate); + virtual ~BTrackVamp(); + + string getIdentifier() const; + string getName() const; + string getDescription() const; + string getMaker() const; + int getPluginVersion() const; + string getCopyright() const; + + InputDomain getInputDomain() const; + size_t getPreferredBlockSize() const; + size_t getPreferredStepSize() const; + size_t getMinChannelCount() const; + size_t getMaxChannelCount() const; + + ParameterList getParameterDescriptors() const; + float getParameter(string identifier) const; + void setParameter(string identifier, float value); + + ProgramList getPrograms() const; + string getCurrentProgram() const; + void selectProgram(string name); + + OutputList getOutputDescriptors() const; + + bool initialise(size_t channels, size_t stepSize, size_t blockSize); + void reset(); + + FeatureSet process(const float *const *inputBuffers, + Vamp::RealTime timestamp); + + FeatureSet getRemainingFeatures(); + +protected: + // plugin-specific data and methods go here + + BTrack b; + + int m_stepSize; + int m_blockSize; +}; + + + +#endif diff -r 92ee4ace9d46 -r deb49a2590f3 modules-and-plug-ins/vamp-plugin/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules-and-plug-ins/vamp-plugin/Makefile Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,104 @@ + +## Skeleton Makefile for Vamp plugin builds using command-line tools. +## This requires GNU make, which is what you get with OS/X, Linux, or +## MinGW/Cygwin on Windows. +## +## Rename this to Makefile, and edit as appropriate. +## This Makefile WILL NOT WORK until you have edited it as described +## below -- the Makefile as supplied does nothing useful at all! +## +## Various sets of options are provided, commented out -- just uncomment +## (remove the '#' characters for) the set that most closely resembles +## your own situation, and adjust to taste. Then run "gmake". +## +## (For Windows builds using MS Visual Studio, start instead with the +## VampExamplePlugins project found in the build directory of the SDK.) + + +# Edit this to the base name of your plugin library +# +PLUGIN_LIBRARY_NAME := btrack-vamp + +# Edit this to list the .cpp or .c files in your plugin project +# +PLUGIN_SOURCES := BTrackVamp.cpp plugins.cpp ../../src/BTrack.cpp ../../src/OnsetDetectionFunction.cpp + +# Edit this to list the .h files in your plugin project +# +PLUGIN_HEADERS := BTrackVamp.h ../../src/BTrack.h ../../src/OnsetDetectionFunction.h + +# Edit this to the location of the Vamp plugin SDK, relative to your +# project directory +# +VAMP_SDK_DIR := /usr/local/lib/vamp-sdk + + +## Uncomment these for an OS/X universal binary (32- and 64-bit Intel) +## supporting 10.5 or newer. Use this if you have OS/X 10.7 with the +## Xcode 4 command-line tools. + +CXX := g++ + +## commented this out while I don't have both 32 and 64 bit versions of the libraries +#CXXFLAGS := -mmacosx-version-min=10.5 -arch i386 -arch x86_64 -I$(VAMP_SDK_DIR) -Wall -fPIC +CXXFLAGS := -mmacosx-version-min=10.5 -arch x86_64 -I$(VAMP_SDK_DIR) -Wall -fPIC +PLUGIN_EXT := .dylib +LDFLAGS := $(CXXFLAGS) -dynamiclib -lfftw3 -lsamplerate -install_name $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list + + +## Uncomment these for an OS/X universal binary (PPC and 32- and +## 64-bit Intel) supporting 10.5 or newer. Use this if you have OS/X +## 10.6 with the Xcode 3 command-line tools. + +# CXXFLAGS := -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -arch i386 -arch x86_64 -arch ppc -I$(VAMP_SDK_DIR) -Wall -fPIC +# PLUGIN_EXT := .dylib +# LDFLAGS := $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list + + +## Uncomment these for an OS/X universal binary (PPC and 32- and +## 64-bit Intel) supporting 10.4 or newer. Use this if you have OS/X +## 10.4, 10.5 or 10.6 and you have the 10.4 SDK installed. + +# CXX := g++-4.0 +# CXXFLAGS := -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -arch ppc -I$(VAMP_SDK_DIR) -Wall -fPIC +# PLUGIN_EXT := .dylib +# LDFLAGS := $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list + + +## Uncomment these for Linux using the standard tools: + +# CXXFLAGS := -I$(VAMP_SDK_DIR) -Wall -fPIC +# PLUGIN_EXT := .so +# LDFLAGS := -shared -Wl,-soname=$(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -Wl,--version-script=vamp-plugin.map + + +## Uncomment these for a cross-compile from Linux to Windows using MinGW: + +# CXX := i586-mingw32msvc-g++ +# CXXFLAGS := -I$(VAMP_SDK_DIR) -Wall +# PLUGIN_EXT := .dll +# LDFLAGS := --static-libgcc -Wl,-soname=$(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) -shared $(VAMP_SDK_DIR)/libvamp-sdk.a + + +## Uncomment these for OpenSolaris using SunStudio compiler and GNU make: + +# CXX := CC +# CXXFLAGS := -G -I$(VAMP_SDK_DIR) +w -KPIC +# PLUGIN_EXT := .so +# LDFLAGS := -G -h$(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) $(VAMP_SDK_DIR)/libvamp-sdk.a -Qoption ld -Mvamp-plugin.map + + + +## All of the above + +PLUGIN_OBJECTS := $(PLUGIN_SOURCES:.cpp=.o) +PLUGIN_OBJECTS := $(PLUGIN_OBJECTS:.c=.o) + +$(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT): $(PLUGIN_OBJECTS) + $(CXX) -o $@ $^ $(LDFLAGS) + +$(PLUGIN_OBJECTS): $(PLUGIN_HEADERS) + +clean: + rm -f *.o + diff -r 92ee4ace9d46 -r deb49a2590f3 modules-and-plug-ins/vamp-plugin/plugins.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules-and-plug-ins/vamp-plugin/plugins.cpp Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,37 @@ + +// This is a skeleton file for use in creating your own plugin +// libraries. Replace MyPlugin and myPlugin throughout with the name +// of your first plugin class, and fill in the gaps as appropriate. + + +#include +#include + +#include "BTrackVamp.h" + + +// Declare one static adapter here for each plugin class in this library. + +static Vamp::PluginAdapter btrackVampAdapter; + + +// This is the entry-point for the library, and the only function that +// needs to be publicly exported. + +const VampPluginDescriptor * +vampGetPluginDescriptor(unsigned int version, unsigned int index) +{ + if (version < 1) return 0; + + // Return a different plugin adaptor's descriptor for each index, + // and return 0 for the first index after you run out of plugins. + // (That's how the host finds out how many plugins are in this + // library.) + + switch (index) { + case 0: return btrackVampAdapter.getDescriptor(); + default: return 0; + } +} + + diff -r 92ee4ace9d46 -r deb49a2590f3 modules-and-plug-ins/vamp-plugin/vamp-plugin.list --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules-and-plug-ins/vamp-plugin/vamp-plugin.list Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,1 @@ +_vampGetPluginDescriptor diff -r 92ee4ace9d46 -r deb49a2590f3 modules-and-plug-ins/vamp-plugin/vamp-plugin.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules-and-plug-ins/vamp-plugin/vamp-plugin.map Mon Jan 27 23:11:31 2014 +0000 @@ -0,0 +1,4 @@ +{ + global: vampGetPluginDescriptor; + local: *; +}; diff -r 92ee4ace9d46 -r deb49a2590f3 src/BTrack.h --- a/src/BTrack.h Sat Jan 25 18:17:51 2014 +0000 +++ b/src/BTrack.h Mon Jan 27 23:11:31 2014 +0000 @@ -35,15 +35,15 @@ public: //======================================================================= - /** constructor assuming hop size of 512 and frame size of 1024 */ + /** Constructor assuming hop size of 512 and frame size of 1024 */ BTrack(); - /** constructor assuming frame size will be double the hopSize + /** Constructor assuming frame size will be double the hopSize * @param hopSize the hop size in audio samples */ BTrack(int hopSize_); - /** constructor taking both hopSize and frameSize + /** Constructor taking both hopSize and frameSize * @param hopSize the hop size in audio samples * @param frameSize the frame size in audio samples */ @@ -80,17 +80,17 @@ */ void setTempo(double tempo); - /** fix tempo to roughly around some value, so that the algorithm will only try to track + /** Fix tempo to roughly around some value, so that the algorithm will only try to track * tempi around the given tempo * @param tempo the tempo in beats per minute (bpm) */ void fixTempo(double tempo); - /** tell the algorithm to not fix the tempo anymore */ + /** Tell the algorithm to not fix the tempo anymore */ void doNotFixTempo(); //======================================================================= - /** calculates a beat time in seconds, given the frame number, hop size and sampling frequency. + /** Calculates a beat time in seconds, given the frame number, hop size and sampling frequency. * This version uses a long to represent the frame number * @param frameNumber the index of the current frame * @param hopSize the hop size in audio samples @@ -99,7 +99,7 @@ */ static double getBeatTimeInSeconds(long frameNumber,int hopSize,int fs); - /** calculates a beat time in seconds, given the frame number, hop size and sampling frequency. + /** Calculates a beat time in seconds, given the frame number, hop size and sampling frequency. * This version uses an int to represent the frame number * @param frameNumber the index of the current frame * @param hopSize the hop size in audio samples @@ -130,20 +130,20 @@ */ void updateCumulativeScore(double odfSample); - /** predicts the next beat, based upon the internal program state */ + /** Predicts the next beat, based upon the internal program state */ void predictBeat(); /** Calculates the current tempo expressed as the beat period in detection function samples */ void calculateTempo(); - /** calculates an adaptive threshold which is used to remove low level energy from detection + /** Calculates an adaptive threshold which is used to remove low level energy from detection * function and emphasise peaks * @param x a pointer to an array containing onset detection function samples * @param N the length of the array, x */ void adaptiveThreshold(double *x,int N); - /** calculates the mean of values in an array between index locations [startIndex,endIndex] + /** Calculates the mean of values in an array between index locations [startIndex,endIndex] * @param array a pointer to an array that contains the values we wish to find the mean from * @param startIndex the start index from which we would like to calculate the mean * @param endIndex the final index to which we would like to calculate the mean @@ -151,23 +151,23 @@ */ double calculateMeanOfArray(double *array,int startIndex,int endIndex); - /** normalises a given array + /** Normalises a given array * @param array a pointer to the array we wish to normalise * @param N the length of the array */ void normaliseArray(double *array,int N); - /** calculates the balanced autocorrelation of the smoothed onset detection function + /** Calculates the balanced autocorrelation of the smoothed onset detection function * @param onsetDetectionFunction a pointer to an array containing the onset detection function */ void calculateBalancedACF(double *onsetDetectionFunction); - /** calculates the output of the comb filter bank */ + /** Calculates the output of the comb filter bank */ void calculateOutputOfCombFilterBank(); //======================================================================= - /** an OnsetDetectionFunction instance for calculating onset detection functions */ + /** An OnsetDetectionFunction instance for calculating onset detection functions */ OnsetDetectionFunction odf; //======================================================================= diff -r 92ee4ace9d46 -r deb49a2590f3 src/OnsetDetectionFunction.h --- a/src/OnsetDetectionFunction.h Sat Jan 25 18:17:51 2014 +0000 +++ b/src/OnsetDetectionFunction.h Mon Jan 27 23:11:31 2014 +0000 @@ -51,6 +51,8 @@ TukeyWindow }; +//======================================================================= +/** A class for calculating onset detection functions. */ class OnsetDetectionFunction { public: