qm-dsp 1.8
Segmenter.h
Go to the documentation of this file.
1#ifndef _SEGMENTER_H
2#define _SEGMENTER_H
3
4/*
5 * Segmenter.h
6 * soundbite
7 *
8 * Created by Mark Levy on 23/03/2006.
9 * Copyright 2006 Centre for Digital Music, Queen Mary, University of London.
10
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version. See the file
15 COPYING included with this distribution for more information.
16 *
17 */
18
19#include <vector>
20#include <iostream>
21
22using std::vector;
23using std::ostream;
24
26{
27public:
28 int start; // in samples
29 int end;
30 int type;
31};
32
34{
35public:
36 int nsegtypes; // number of segment types, so possible types are {0,1,...,nsegtypes-1}
38 vector<Segment> segments;
39};
40
41ostream& operator<<(ostream& os, const Segmentation& s);
42
44{
45public:
47 virtual ~Segmenter() {}
48 virtual void initialise(int samplerate) = 0; // must be called before any other methods
49 virtual int getWindowsize() = 0; // required window size for calls to extractFeatures()
50 virtual int getHopsize() = 0; // required hop size for calls to extractFeatures()
51 virtual void extractFeatures(const double* samples, int nsamples) = 0;
52 virtual void segment() = 0; // call once all the features have been extracted
53 virtual void segment(int m) = 0; // specify desired number of segment-types
54 virtual void clear() { features.clear(); }
55 const Segmentation& getSegmentation() const { return segmentation; }
56protected:
57 vector<vector<double> > features;
60};
61
62#endif
ostream & operator<<(ostream &os, const Segmentation &s)
Definition Segmenter.cpp:19
int type
Definition Segmenter.h:30
int start
Definition Segmenter.h:28
int end
Definition Segmenter.h:29
vector< Segment > segments
Definition Segmenter.h:38
Segmentation segmentation
Definition Segmenter.h:58
virtual void segment(int m)=0
int samplerate
Definition Segmenter.h:59
virtual void extractFeatures(const double *samples, int nsamples)=0
virtual ~Segmenter()
Definition Segmenter.h:47
virtual int getHopsize()=0
virtual void segment()=0
virtual int getWindowsize()=0
virtual void clear()
Definition Segmenter.h:54
const Segmentation & getSegmentation() const
Definition Segmenter.h:55
vector< vector< double > > features
Definition Segmenter.h:57
virtual void initialise(int samplerate)=0