annotate dsp/segmentation/Segmenter.h @ 96:88f3cfcff55f

A threshold (delta) is added in the peak picking parameters structure (PPickParams). It is used as an offset when computing the smoothed detection function. A constructor for the structure PPickParams is also added to set the parameters to 0 when a structure instance is created. Hence programmes using the peak picking parameter structure and which do not set the delta parameter (e.g. QM Vamp note onset detector) won't be affected by the modifications. Functions modified: - dsp/onsets/PeakPicking.cpp - dsp/onsets/PeakPicking.h - dsp/signalconditioning/DFProcess.cpp - dsp/signalconditioning/DFProcess.h
author mathieub <mathieu.barthet@eecs.qmul.ac.uk>
date Mon, 20 Jun 2011 19:01:48 +0100
parents e5907ae6de17
children 175e51ae78eb
rev   line source
cannam@18 1 #ifndef _SEGMENTER_H
cannam@18 2 #define _SEGMENTER_H
cannam@18 3
cannam@18 4 /*
cannam@18 5 * Segmenter.h
cannam@18 6 * soundbite
cannam@18 7 *
cannam@18 8 * Created by Mark Levy on 23/03/2006.
Chris@84 9 * Copyright 2006 Centre for Digital Music, Queen Mary, University of London.
Chris@84 10
Chris@84 11 This program is free software; you can redistribute it and/or
Chris@84 12 modify it under the terms of the GNU General Public License as
Chris@84 13 published by the Free Software Foundation; either version 2 of the
Chris@84 14 License, or (at your option) any later version. See the file
Chris@84 15 COPYING included with this distribution for more information.
cannam@18 16 *
cannam@18 17 */
cannam@18 18
cannam@18 19 #include <vector>
cannam@18 20 #include <iostream>
cannam@18 21
cannam@18 22 using std::vector;
cannam@18 23 using std::ostream;
cannam@18 24
cannam@18 25 class Segment
cannam@18 26 {
cannam@18 27 public:
cannam@18 28 int start; // in samples
cannam@18 29 int end;
cannam@18 30 int type;
cannam@18 31 };
cannam@18 32
cannam@18 33 class Segmentation
cannam@18 34 {
cannam@18 35 public:
cannam@18 36 int nsegtypes; // number of segment types, so possible types are {0,1,...,nsegtypes-1}
cannam@18 37 int samplerate;
cannam@18 38 vector<Segment> segments;
cannam@18 39 };
cannam@18 40
cannam@18 41 ostream& operator<<(ostream& os, const Segmentation& s);
cannam@18 42
cannam@18 43 class Segmenter
cannam@18 44 {
cannam@18 45 public:
cannam@18 46 Segmenter() {}
cannam@18 47 virtual ~Segmenter() {}
cannam@18 48 virtual void initialise(int samplerate) = 0; // must be called before any other methods
cannam@18 49 virtual int getWindowsize() = 0; // required window size for calls to extractFeatures()
cannam@18 50 virtual int getHopsize() = 0; // required hop size for calls to extractFeatures()
cannam@24 51 virtual void extractFeatures(const double* samples, int nsamples) = 0;
cannam@18 52 virtual void segment() = 0; // call once all the features have been extracted
cannam@18 53 virtual void segment(int m) = 0; // specify desired number of segment-types
cannam@18 54 virtual void clear() { features.clear(); }
cannam@18 55 const Segmentation& getSegmentation() const { return segmentation; }
cannam@18 56 protected:
cannam@18 57 vector<vector<double> > features;
cannam@18 58 Segmentation segmentation;
cannam@18 59 int samplerate;
cannam@18 60 };
cannam@18 61
cannam@18 62 #endif