annotate SparseHMM.h @ 131:b877df85ad9e fixedlag

mono pitch works now with the refactored HMM implementation
author Matthias Mauch <mail@matthiasmauch.net>
date Fri, 03 Jul 2015 14:09:05 +0100
parents 080fe18f5ebf
children 926c292fa3ff
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@130 28 SparseHMM();
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@130 36 vector<int> finalise();
mail@130 37 // "sparse" HMM definition
mail@130 38 int m_nState;
mail@130 39 int m_nTrans;
mail@130 40 vector<double> m_init;
mail@130 41 vector<size_t> m_from;
mail@130 42 vector<size_t> m_to;
mail@130 43 vector<double> m_transProb;
mail@130 44
mail@130 45 // variables for decoding
mail@130 46 deque<double> m_scale;
mail@130 47 deque<vector<int> > m_psi;
mail@130 48 vector<double> m_delta;
mail@130 49 vector<double> m_oldDelta;
matthiasm@0 50 };
matthiasm@0 51
Chris@9 52 #endif