Chris@7
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@7
|
2
|
Chris@7
|
3 /*
|
Chris@7
|
4 Vamp feature extraction plugin for the BeatRoot beat tracker.
|
Chris@7
|
5
|
Chris@7
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@7
|
7 This file copyright 2011 Simon Dixon, Chris Cannam and QMUL.
|
Chris@7
|
8
|
Chris@7
|
9 This program is free software; you can redistribute it and/or
|
Chris@7
|
10 modify it under the terms of the GNU General Public License as
|
Chris@7
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@7
|
12 License, or (at your option) any later version. See the file
|
Chris@7
|
13 COPYING included with this distribution for more information.
|
Chris@7
|
14 */
|
Chris@7
|
15
|
Chris@7
|
16 #ifndef _INDUCTION_H_
|
Chris@7
|
17 #define _INDUCTION_H_
|
Chris@7
|
18
|
Chris@7
|
19 #include "Agent.h"
|
Chris@9
|
20 #include "AgentList.h"
|
Chris@7
|
21 #include "Event.h"
|
Chris@7
|
22
|
Chris@7
|
23 #include <vector>
|
Chris@7
|
24
|
Chris@12
|
25 #ifdef DEBUG_BEATROOT
|
Chris@12
|
26 #include <iostream>
|
Chris@12
|
27 #endif
|
Chris@12
|
28
|
Chris@7
|
29 using std::vector;
|
Chris@7
|
30
|
Chris@7
|
31 /** Performs tempo induction by finding clusters of similar
|
Chris@7
|
32 * inter-onset intervals (IOIs), ranking them according to the number
|
Chris@7
|
33 * of intervals and relationships between them, and returning a set
|
Chris@7
|
34 * of tempo hypotheses for initialising the beat tracking agents.
|
Chris@7
|
35 */
|
Chris@7
|
36 class Induction
|
Chris@7
|
37 {
|
Chris@7
|
38 public:
|
Chris@7
|
39 /** The maximum difference in IOIs which are in the same cluster */
|
Chris@7
|
40 static double clusterWidth;
|
Chris@7
|
41
|
Chris@7
|
42 /** The minimum IOI for inclusion in a cluster */
|
Chris@7
|
43 static double minIOI;
|
Chris@7
|
44
|
Chris@7
|
45 /** The maximum IOI for inclusion in a cluster */
|
Chris@7
|
46 static double maxIOI;
|
Chris@7
|
47
|
Chris@7
|
48 /** The minimum inter-beat interval (IBI), i.e. the maximum tempo
|
Chris@7
|
49 * hypothesis that can be returned.
|
Chris@7
|
50 * 0.30 seconds == 200 BPM
|
Chris@7
|
51 * 0.25 seconds == 240 BPM
|
Chris@7
|
52 */
|
Chris@7
|
53 static double minIBI;
|
Chris@7
|
54
|
Chris@7
|
55 /** The maximum inter-beat interval (IBI), i.e. the minimum tempo
|
Chris@7
|
56 * hypothesis that can be returned.
|
Chris@7
|
57 * 1.00 seconds == 60 BPM
|
Chris@7
|
58 * 0.75 seconds == 80 BPM
|
Chris@7
|
59 * 0.60 seconds == 100 BPM
|
Chris@7
|
60 */
|
Chris@7
|
61 static double maxIBI; // 60BPM // was 0.75 => 80
|
Chris@7
|
62
|
Chris@7
|
63 /** The maximum number of tempo hypotheses to return */
|
Chris@7
|
64 static int topN;
|
Chris@7
|
65
|
Chris@7
|
66 /** Performs tempo induction (see JNMR 2001 paper by Simon Dixon for details).
|
Chris@7
|
67 * @param events The onsets (or other events) from which the tempo is induced
|
Chris@7
|
68 * @return A list of beat tracking agents, where each is initialised with one
|
Chris@7
|
69 * of the top tempo hypotheses but no beats
|
Chris@7
|
70 */
|
Chris@23
|
71 static AgentList beatInduction(AgentParameters params, EventList events);
|
Chris@7
|
72
|
Chris@7
|
73 protected:
|
Chris@7
|
74 /** For variable cluster widths in newInduction().
|
Chris@7
|
75 * @param low The lowest IOI allowed in the cluster
|
Chris@7
|
76 * @return The highest IOI allowed in the cluster
|
Chris@7
|
77 */
|
Chris@7
|
78 static int top(int low) {
|
Chris@7
|
79 return low + 25; // low/10;
|
Chris@7
|
80 } // top()
|
Chris@7
|
81
|
Chris@7
|
82 }; // class Induction
|
Chris@7
|
83
|
Chris@7
|
84 #endif
|