changeset 182:e1718e64a921 noteagent

Remove some irrelevant code
author Chris Cannam
date Fri, 23 May 2014 17:03:27 +0100
parents 10e7c3ff575e
children 9b9cdfccbd14
files src/NoteHypothesis.cpp src/NoteHypothesis.h
diffstat 2 files changed, 0 insertions(+), 148 deletions(-) [+]
line wrap: on
line diff
--- a/src/NoteHypothesis.cpp	Fri May 23 12:40:18 2014 +0100
+++ b/src/NoteHypothesis.cpp	Fri May 23 17:03:27 2014 +0100
@@ -243,114 +243,3 @@
         return i->time - start;
     }
 }
-
-std::vector<double>
-NoteHypothesis::sample(const std::set<NoteHypothesis> &notes,
-                       RealTime startTime,
-                       RealTime endTime,
-                       RealTime interval)
-{
-    //!!! where should this live? in AgentHypothesis? a Feeder class?
-
-    assert(interval > RealTime::zeroTime);
-
-    Observations obs = flatten(notes);
-    Observations::const_iterator oi = obs.begin();
-
-//    std::cerr << "sample: start " << startTime << " end " << endTime << " interval " << interval << std::endl;
-
-//    std::cerr << "sample: flatten gives " << obs.size() << " observations" << std::endl;
-    
-    std::vector<double> samples;
-
-    RealTime obsInterval;
-
-    RealTime t = startTime;
-
-    while (oi != obs.end()) {
-
-        Observation o = *oi;
-
-        if (obsInterval == RealTime()) {
-            //!!! should pull out a function to establish this from the list
-            Observations::const_iterator oj = oi;
-            ++oj;
-            if (oj != obs.end()) {
-                obsInterval = oj->time - o.time;
-            }
-        }
-
-//        std::cerr << "t = " << t << ", o.time = " << o.time << ", interval = " << interval << ", obsInterval = " << obsInterval << std::endl;
-
-        if (t > endTime) {
-            break;
-        } else if (o.time > t) {
-            samples.push_back(0.0);
-            t = t + interval;
-        } else if (o.time + obsInterval <= t) {
-            ++oi;
-        } else {
-            samples.push_back(o.value);
-            t = t + interval;
-        }
-    }
-
-    while (1) {
-//        std::cerr << "t = " << t << std::endl;
-        if (t > endTime) {
-            break;
-        } else {
-            samples.push_back(0.0);
-            t = t + interval;
-        }
-    }
-
-    return samples;
-}
-
-std::vector<double>
-NoteHypothesis::winnow(const Observations &obs,
-                       RealTime startTime,
-                       RealTime endTime,
-                       RealTime interval)
-{
-    AgentFeederPoly<NoteHypothesis> feeder;
-    
-#ifdef DEBUG_NOTE_HYPOTHESIS
-    std::cerr << "winnow: " << obs.size() << " input observations"
-              << std::endl;
-    int nonzero = 0;
-#endif
-
-    for (Observations::const_iterator i = obs.begin();
-         i != obs.end(); ++i) {
-        if (i->value != 0.0) { // 0.0 is a special unvoiced value
-            feeder.feed(*i);
-#ifdef DEBUG_NOTE_HYPOTHESIS
-            std::cerr << i->value << "  ";
-            ++nonzero;
-            if (nonzero % 6 == 0) {
-                std::cerr << std::endl;
-            }
-#endif
-        }
-    }
-    
-#ifdef DEBUG_NOTE_HYPOTHESIS
-    std::cerr << "winnow: " << nonzero << " non-zero"
-              << std::endl;
-#endif
-
-    feeder.finish();
-
-    AgentFeederPoly<NoteHypothesis>::Hypotheses accepted =
-        feeder.getAcceptedHypotheses();
-    
-#ifdef DEBUG_NOTE_HYPOTHESIS
-    std::cerr << "winnow: " << accepted.size() << " accepted hypotheses"
-              << std::endl;
-#endif
-
-    return NoteHypothesis::sample(accepted, startTime, endTime, interval);
-}
-
--- a/src/NoteHypothesis.h	Fri May 23 12:40:18 2014 +0100
+++ b/src/NoteHypothesis.h	Fri May 23 17:03:27 2014 +0100
@@ -79,43 +79,6 @@
      */
     Vamp::RealTime getDuration() const;
 
-    /**
-     * Convert the given sequence of accepted hypotheses into a
-     * sampled series of pitches (in Hz), returned at regular
-     * intervals determined by the given start time, end time, and
-     * interval. The range is [start,end], i.e. the end time is
-     * included. The interval must be greater than zero.
-     *
-     * Unvoiced samples are returned as 0Hz.
-     */
-    static std::vector<double> sample(const std::set<NoteHypothesis> &,
-                                      Vamp::RealTime startTime,
-                                      Vamp::RealTime endTime,
-                                      Vamp::RealTime interval);
-
-    /**
-     *!!! No! Not equally spaced, should be able to be anything [ordered]
-     
-     * Given a series of equally spaced observations, return a series
-     * of the same number of pitches (in Hz) calculated by running an
-     * AgentFeeder<NoteHypothesis> on the observations and flattening
-     * and sampling the resulting accepted hypotheses.
-     *
-     * The result should contain only pitches that contributed to
-     * recognised notes in the input observations, with the remaining
-     * (unvoiced) samples returned as 0Hz.
-     *
-     * If the input observations are not equally spaced, the result is
-     * undefined.
-     *!!! (what about rounding errors from RealTime to frame and vice versa?)
-     *!!! (should provide a Timebase?)
-     *!!! update docs for updated api
-     */
-    static std::vector<double> winnow(const Observations &,
-                                      Vamp::RealTime startTime,
-                                      Vamp::RealTime endTime,
-                                      Vamp::RealTime interval);
-
     //!!!
     bool operator==(const NoteHypothesis &other) const {
         return m_state == other.m_state && m_pending == other.m_pending;