matthiasm@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@9: matthiasm@0: /* Chris@9: pYIN - A fundamental frequency estimator for monophonic audio Chris@9: Centre for Digital Music, Queen Mary, University of London. Chris@9: Chris@9: This program is free software; you can redistribute it and/or Chris@9: modify it under the terms of the GNU General Public License as Chris@9: published by the Free Software Foundation; either version 2 of the Chris@9: License, or (at your option) any later version. See the file Chris@9: COPYING included with this distribution for more information. matthiasm@0: */ matthiasm@0: matthiasm@0: #ifndef _SPARSEHMM_H_ matthiasm@0: #define _SPARSEHMM_H_ matthiasm@0: matthiasm@0: #include mail@130: #include matthiasm@0: #include matthiasm@0: matthiasm@0: using std::vector; mail@130: using std::deque; matthiasm@0: using std::pair; matthiasm@0: matthiasm@0: class SparseHMM matthiasm@0: { matthiasm@0: public: Chris@146: SparseHMM(int fixedLag); // set fixedLag == 0 when doing full Viterbi Chris@146: Chris@146: virtual std::vector calculateObsProb Chris@156: (const vector > &) = 0; Chris@146: mail@130: virtual void build(); Chris@145: std::vector decodeViterbi(std::vector > obs); mail@131: void reset(); mail@130: void initialise(vector firstObs); mail@130: int process(vector newObs); Chris@145: vector track(); Chris@146: mail@130: // "sparse" HMM definition mail@132: int m_fixedLag; mail@130: int m_nState; mail@130: int m_nTrans; mail@130: vector m_init; mail@130: vector m_from; mail@130: vector m_to; mail@130: vector m_transProb; mail@130: mail@130: // variables for decoding mail@130: deque m_scale; mail@130: deque > m_psi; mail@130: vector m_delta; mail@130: vector m_oldDelta; matthiasm@0: }; matthiasm@0: Chris@9: #endif