annotate SparseHMM.h @ 132:926c292fa3ff fixedlag

fixed lag smoothing for pitch track working
author Matthias Mauch <mail@matthiasmauch.net>
date Fri, 03 Jul 2015 17:34:38 +0100
parents b877df85ad9e
children 0432723faf03
rev   line source
matthiasm@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@9 2
matthiasm@0 3 /*
Chris@9 4 pYIN - A fundamental frequency estimator for monophonic audio
Chris@9 5 Centre for Digital Music, Queen Mary, University of London.
Chris@9 6
Chris@9 7 This program is free software; you can redistribute it and/or
Chris@9 8 modify it under the terms of the GNU General Public License as
Chris@9 9 published by the Free Software Foundation; either version 2 of the
Chris@9 10 License, or (at your option) any later version. See the file
Chris@9 11 COPYING included with this distribution for more information.
matthiasm@0 12 */
matthiasm@0 13
matthiasm@0 14 #ifndef _SPARSEHMM_H_
matthiasm@0 15 #define _SPARSEHMM_H_
matthiasm@0 16
matthiasm@0 17 #include <vector>
mail@130 18 #include <queue>
matthiasm@0 19 #include <cstdio>
matthiasm@0 20
matthiasm@0 21 using std::vector;
mail@130 22 using std::deque;
matthiasm@0 23 using std::pair;
matthiasm@0 24
matthiasm@0 25 class SparseHMM
matthiasm@0 26 {
matthiasm@0 27 public:
mail@132 28 SparseHMM(int fixedLag);
mail@130 29 virtual const std::vector<double>
mail@130 30 calculateObsProb(const vector<pair<double, double> >);
mail@130 31 virtual void build();
mail@130 32 const std::vector<int> decodeViterbi(std::vector<vector<double> > obs);
mail@131 33 void reset();
mail@130 34 void initialise(vector<double> firstObs);
mail@130 35 int process(vector<double> newObs);
mail@132 36 const vector<int> track();
mail@130 37 // "sparse" HMM definition
mail@132 38 int m_fixedLag;
mail@130 39 int m_nState;
mail@130 40 int m_nTrans;
mail@130 41 vector<double> m_init;
mail@130 42 vector<size_t> m_from;
mail@130 43 vector<size_t> m_to;
mail@130 44 vector<double> m_transProb;
mail@130 45
mail@130 46 // variables for decoding
mail@130 47 deque<double> m_scale;
mail@130 48 deque<vector<int> > m_psi;
mail@130 49 vector<double> m_delta;
mail@130 50 vector<double> m_oldDelta;
matthiasm@0 51 };
matthiasm@0 52
Chris@9 53 #endif