ClusterMeltSegmenter.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  * ClusterMeltSegmenter.h
5  *
6  * Created by Mark Levy on 23/03/2006.
7  * Copyright 2006 Centre for Digital Music, Queen Mary, University of London.
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 QM_DSP_CLUSTER_MELT_SEGMENTER_H
17 #define QM_DSP_CLUSTER_MELT_SEGMENTER_H
18 
19 #include <vector>
20 
21 #include "segment.h"
22 #include "Segmenter.h"
23 #include "hmm/hmm.h"
24 #include "base/Window.h"
25 
26 class Decimator;
27 class ConstantQ;
28 class MFCC;
29 class FFTReal;
30 
32 // defaults are sensible for 11025Hz with 0.2 second hopsize
33 {
34 public:
37  hopSize(0.2),
38  windowSize(0.6),
39  fmin(62),
40  fmax(16000),
41  nbins(8),
42  ncomponents(20),
43  nHMMStates(40),
44  nclusters(10),
45  histogramLength(15),
46  neighbourhoodLimit(20) { }
48  double hopSize; // in secs
49  double windowSize; // in secs
50  int fmin;
51  int fmax;
52  int nbins;
55  int nclusters;
58 };
59 
61 {
62 public:
64  virtual ~ClusterMeltSegmenter();
65  virtual void initialise(int samplerate);
66  virtual int getWindowsize();
67  virtual int getHopsize();
68  virtual void extractFeatures(const double* samples, int nsamples);
69  void setFeatures(const std::vector<std::vector<double> >& f); // provide the features yourself
70  virtual void segment(); // segment into default number of segment-types
71  void segment(int m); // segment into m segment-types
72  int getNSegmentTypes() { return nclusters; }
73 
74 protected:
75  void makeSegmentation(int* q, int len);
76 
77  void extractFeaturesConstQ(const double *, int);
78  void extractFeaturesMFCC(const double *, int);
79 
84  model_t* model; // the HMM
85  int* q; // the decoded HMM state sequence
86  std::vector<std::vector<double> > histograms;
87 
89  double hopSize; // in seconds
90  double windowSize; // in seconds
91 
92  // constant-Q parameters
93  int fmin;
94  int fmax;
95  int nbins;
96  int ncoeff;
97 
98  // PCA parameters
100 
101  // HMM parameters
103 
104  // clustering parameters
108 
110 };
111 
112 #endif
std::vector< std::vector< double > > histograms
feature_types
Definition: segment.h:38
Definition: FFT.h:52
Decimator carries out a fast downsample by a power-of-two factor.
Definition: Decimator.h:24
Window< double > * window
Definition: MFCC.h:35