Mercurial > hg > silvet
changeset 34:7d81407a2fd8
Start on EM class
author | Chris Cannam |
---|---|
date | Fri, 04 Apr 2014 14:28:41 +0100 |
parents | e08c330a761d |
children | 461d94ed3816 |
files | .hgignore .hgsubstate src/EM.cpp src/EM.h src/Silvet.cpp src/Silvet.h |
diffstat | 6 files changed, 92 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Fri Apr 04 13:43:51 2014 +0100 +++ b/.hgignore Fri Apr 04 14:28:41 2014 +0100 @@ -1,4 +1,8 @@ syntax: glob *~ *.orig +*.o +*.class +*.bak +*.so
--- a/.hgsubstate Fri Apr 04 13:43:51 2014 +0100 +++ b/.hgsubstate Fri Apr 04 14:28:41 2014 +0100 @@ -1,1 +1,1 @@ -ac0617538cf86fe83ffb8e352d7d04a2d7b9bb99 constant-q-cpp +3393a2898a1db0d97fe63f32a28f82001454171e constant-q-cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/EM.cpp Fri Apr 04 14:28:41 2014 +0100 @@ -0,0 +1,19 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Silvet + + A Vamp plugin for note transcription. + Centre for Digital Music, Queen Mary University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#include "EM.h" + +#include "data/include/templates.h" +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/EM.h Fri Apr 04 14:28:41 2014 +0100 @@ -0,0 +1,41 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Silvet + + A Vamp plugin for note transcription. + Centre for Digital Music, Queen Mary University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef SILVET_EM_H +#define SILVET_EM_H + +#include <vector> + +class EM +{ +public: + EM(); + ~EM(); + + void iterate(const std::vector<double> &column); + +private: + typedef std::vector<double> V; + typedef std::vector<std::vector<double> > Grid; + + V m_pitches; + Grid m_sources; + Grid m_q; + + int m_lowest; + int m_highest; +}; + +#endif
--- a/src/Silvet.cpp Fri Apr 04 13:43:51 2014 +0100 +++ b/src/Silvet.cpp Fri Apr 04 14:28:41 2014 +0100 @@ -14,8 +14,7 @@ */ #include "Silvet.h" - -#include "data/include/templates.h" +#include "EM.h" #include "maths/MedianFilter.h" #include "dsp/rateconversion/Resampler.h" @@ -267,6 +266,19 @@ } Grid cqout = m_cq->process(data); + return transcribe(cqout); +} + +Silvet::FeatureSet +Silvet::getRemainingFeatures() +{ + Grid cqout = m_cq->getRemainingBlocks(); + return transcribe(cqout); +} + +Silvet::FeatureSet +Silvet::transcribe(const Grid &cqout) +{ Grid filtered = preProcess(cqout); FeatureSet fs; @@ -279,16 +291,21 @@ fs[m_cqOutputNo].push_back(f); } + int width = filtered.size(); + + int iterations = 12; + + for (int i = 0; i < width; ++i) { + EM em; + for (int j = 0; j < iterations; ++j) { + em.iterate(filtered[i]); + } + //!!! now do something with the results from em! + } + return fs; } -Silvet::FeatureSet -Silvet::getRemainingFeatures() -{ - - return FeatureSet(); -} - Silvet::Grid Silvet::preProcess(const Grid &in) { @@ -331,8 +348,6 @@ int ix = inCol.size() - j - 55; - //!!! note these filters introduce more latency - double val = inCol[ix]; m_filterA[j]->push(val);
--- a/src/Silvet.h Fri Apr 04 13:43:51 2014 +0100 +++ b/src/Silvet.h Fri Apr 04 14:28:41 2014 +0100 @@ -75,6 +75,7 @@ vector<MedianFilter<double> *> m_filterA; vector<MedianFilter<double> *> m_filterB; Grid preProcess(const Grid &); + FeatureSet transcribe(const Grid &); int m_blockSize; int m_columnCount;