1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
4 * ClusterMeltSegmenter.h
6 * Created by Mark Levy on 23/03/2006.
7 * Copyright 2006 Centre for Digital Music, Queen Mary, University of London.
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.
19 #include "Segmenter.h"
21 #include "base/Window.h"
30 class ClusterMeltSegmenterParams
31 // defaults are sensible for 11025Hz with 0.2 second hopsize
34 ClusterMeltSegmenterParams() :
35 featureType(FEATURE_TYPE_CONSTQ),
45 neighbourhoodLimit(20) { }
46 feature_types featureType;
47 double hopSize; // in secs
48 double windowSize; // in secs
56 int neighbourhoodLimit;
59 class ClusterMeltSegmenter : public Segmenter
62 ClusterMeltSegmenter(ClusterMeltSegmenterParams params);
63 virtual ~ClusterMeltSegmenter();
64 virtual void initialise(int samplerate);
65 virtual int getWindowsize();
66 virtual int getHopsize();
67 virtual void extractFeatures(const double* samples, int nsamples);
68 void setFeatures(const vector<vector<double> >& f); // provide the features yourself
69 virtual void segment(); // segment into default number of segment-types
70 void segment(int m); // segment into m segment-types
71 int getNSegmentTypes() { return nclusters; }
74 void makeSegmentation(int* q, int len);
76 void extractFeaturesConstQ(const double *, int);
77 void extractFeaturesMFCC(const double *, int);
79 Window<double> *window;
83 model_t* model; // the HMM
84 int* q; // the decoded HMM state sequence
85 vector<vector<double> > histograms;
87 feature_types featureType;
88 double hopSize; // in seconds
89 double windowSize; // in seconds
91 // constant-Q parameters
103 // clustering parameters
106 int neighbourhoodLimit;
108 Decimator *decimator;