annotate src/EM.h @ 69:9c7e6086192d

Run again, with files normalised as in the MIREX tests
author Chris Cannam
date Tue, 29 Apr 2014 12:05:52 +0100
parents 384338fa460d
children a0dedcbfa628 e282930cfca7
rev   line source
Chris@34 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@34 2
Chris@34 3 /*
Chris@34 4 Silvet
Chris@34 5
Chris@34 6 A Vamp plugin for note transcription.
Chris@34 7 Centre for Digital Music, Queen Mary University of London.
Chris@34 8
Chris@34 9 This program is free software; you can redistribute it and/or
Chris@34 10 modify it under the terms of the GNU General Public License as
Chris@34 11 published by the Free Software Foundation; either version 2 of the
Chris@34 12 License, or (at your option) any later version. See the file
Chris@34 13 COPYING included with this distribution for more information.
Chris@34 14 */
Chris@34 15
Chris@34 16 #ifndef SILVET_EM_H
Chris@34 17 #define SILVET_EM_H
Chris@34 18
Chris@34 19 #include <vector>
Chris@34 20
Chris@34 21 class EM
Chris@34 22 {
Chris@34 23 public:
Chris@34 24 EM();
Chris@34 25 ~EM();
Chris@34 26
Chris@36 27 void iterate(std::vector<double> column);
Chris@34 28
Chris@38 29 const std::vector<double> &getEstimate() const {
Chris@38 30 return m_estimate;
Chris@38 31 }
Chris@38 32 const std::vector<double> &getPitchDistribution() const {
Chris@38 33 return m_pitches;
Chris@38 34 }
Chris@38 35 const std::vector<std::vector<double> > &getSources() const {
Chris@38 36 return m_sources;
Chris@38 37 }
Chris@38 38
Chris@34 39 private:
Chris@34 40 typedef std::vector<double> V;
Chris@34 41 typedef std::vector<std::vector<double> > Grid;
Chris@34 42
Chris@34 43 V m_pitches;
Chris@55 44 Grid m_shifts;
Chris@34 45 Grid m_sources;
Chris@36 46
Chris@36 47 V m_estimate;
Chris@36 48 V m_q;
Chris@34 49
Chris@45 50 int m_noteCount;
Chris@45 51 int m_shiftCount; // 1 + 2 * max template shift
Chris@45 52 int m_binCount;
Chris@45 53 int m_instrumentCount;
Chris@42 54
Chris@42 55 double m_pitchSparsity;
Chris@42 56 double m_sourceSparsity;
Chris@35 57
Chris@45 58 int m_lowestPitch;
Chris@45 59 int m_highestPitch;
Chris@35 60
Chris@55 61 void normaliseColumn(V &column);
Chris@55 62 void normaliseGrid(Grid &grid);
Chris@36 63 void expectation(const V &column);
Chris@36 64 void maximisation(const V &column);
Chris@36 65
Chris@55 66 const float *templateFor(int instrument, int note, int shift);
Chris@45 67 void rangeFor(int instrument, int &minPitch, int &maxPitch);
Chris@45 68 bool inRange(int instrument, int pitch);
Chris@34 69 };
Chris@34 70
Chris@34 71 #endif