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