Chris@7: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@7: Chris@7: /* Chris@7: Vamp feature extraction plugin for the BeatRoot beat tracker. Chris@7: Chris@7: Centre for Digital Music, Queen Mary, University of London. Chris@7: This file copyright 2011 Simon Dixon, Chris Cannam and QMUL. Chris@7: Chris@7: This program is free software; you can redistribute it and/or Chris@7: modify it under the terms of the GNU General Public License as Chris@7: published by the Free Software Foundation; either version 2 of the Chris@7: License, or (at your option) any later version. See the file Chris@7: COPYING included with this distribution for more information. Chris@7: */ Chris@7: Chris@7: #ifndef _INDUCTION_H_ Chris@7: #define _INDUCTION_H_ Chris@7: Chris@7: #include "Agent.h" Chris@9: #include "AgentList.h" Chris@7: #include "Event.h" Chris@7: Chris@7: #include Chris@7: Chris@12: #ifdef DEBUG_BEATROOT Chris@12: #include Chris@12: #endif Chris@12: Chris@7: using std::vector; Chris@7: Chris@7: /** Performs tempo induction by finding clusters of similar Chris@7: * inter-onset intervals (IOIs), ranking them according to the number Chris@7: * of intervals and relationships between them, and returning a set Chris@7: * of tempo hypotheses for initialising the beat tracking agents. Chris@7: */ Chris@7: class Induction Chris@7: { Chris@7: public: Chris@7: /** The maximum difference in IOIs which are in the same cluster */ Chris@7: static double clusterWidth; Chris@7: Chris@7: /** The minimum IOI for inclusion in a cluster */ Chris@7: static double minIOI; Chris@7: Chris@7: /** The maximum IOI for inclusion in a cluster */ Chris@7: static double maxIOI; Chris@7: Chris@7: /** The minimum inter-beat interval (IBI), i.e. the maximum tempo Chris@7: * hypothesis that can be returned. Chris@7: * 0.30 seconds == 200 BPM Chris@7: * 0.25 seconds == 240 BPM Chris@7: */ Chris@7: static double minIBI; Chris@7: Chris@7: /** The maximum inter-beat interval (IBI), i.e. the minimum tempo Chris@7: * hypothesis that can be returned. Chris@7: * 1.00 seconds == 60 BPM Chris@7: * 0.75 seconds == 80 BPM Chris@7: * 0.60 seconds == 100 BPM Chris@7: */ Chris@7: static double maxIBI; // 60BPM // was 0.75 => 80 Chris@7: Chris@7: /** The maximum number of tempo hypotheses to return */ Chris@7: static int topN; Chris@7: Chris@7: /** Performs tempo induction (see JNMR 2001 paper by Simon Dixon for details). Chris@7: * @param events The onsets (or other events) from which the tempo is induced Chris@7: * @return A list of beat tracking agents, where each is initialised with one Chris@7: * of the top tempo hypotheses but no beats Chris@7: */ Chris@23: static AgentList beatInduction(AgentParameters params, EventList events); Chris@7: Chris@7: protected: Chris@7: /** For variable cluster widths in newInduction(). Chris@7: * @param low The lowest IOI allowed in the cluster Chris@7: * @return The highest IOI allowed in the cluster Chris@7: */ Chris@7: static int top(int low) { Chris@7: return low + 25; // low/10; Chris@7: } // top() Chris@7: Chris@7: }; // class Induction Chris@7: Chris@7: #endif