# HG changeset patch # User Chris Cannam # Date 1413391220 -3600 # Node ID 19fd6cb033c7f00b6629a455006cf2e394886efd # Parent 71bef111e130830ad5716fb5a060ba55afb37be6 Add pitch activation matrix output diff -r 71bef111e130 -r 19fd6cb033c7 src/Silvet.cpp --- a/src/Silvet.cpp Fri Aug 08 11:54:54 2014 +0100 +++ b/src/Silvet.cpp Wed Oct 15 17:40:20 2014 +0100 @@ -249,7 +249,7 @@ d.binCount = m_instruments[0].templateHeight; d.binNames.clear(); if (m_cq) { - char name[20]; + char name[50]; for (int i = 0; i < m_instruments[0].templateHeight; ++i) { // We have a 600-bin (10 oct 60-bin CQ) of which the // lowest-frequency 55 bins have been dropped, for a @@ -270,6 +270,26 @@ m_fcqOutputNo = list.size(); list.push_back(d); + d.identifier = "pitchactivation"; + d.name = "Pitch activation distribution"; + d.description = "Pitch activation distribution resulting from expectation-maximisation algorithm, prior to note extraction."; + d.unit = ""; + d.hasFixedBinCount = true; + d.binCount = m_instruments[0].templateNoteCount; + d.binNames.clear(); + if (m_cq) { + for (int i = 0; i < m_instruments[0].templateNoteCount; ++i) { + d.binNames.push_back(noteName(i, 0, 1)); + } + } + d.hasKnownExtents = false; + d.isQuantized = false; + d.sampleType = OutputDescriptor::FixedSampleRate; + d.sampleRate = m_colsPerSec; + d.hasDuration = false; + m_pitchOutputNo = list.size(); + list.push_back(d); + return list; } @@ -569,7 +589,16 @@ continue; } - postProcess(localPitches[i], localBestShifts[i], wantShifts); + vector filtered = postProcess + (localPitches[i], localBestShifts[i], wantShifts); + + Feature f; + for (int j = 0; j < (int)filtered.size(); ++j) { + float v(filtered[j]); + if (v < pack.levelThreshold) v = 0.f; + f.values.push_back(v); + } + fs[m_pitchOutputNo].push_back(f); FeatureList noteFeatures = noteTrack(shiftCount); @@ -666,7 +695,7 @@ return out; } -void +vector Silvet::postProcess(const vector &pitches, const vector &bestShifts, bool wantShifts) @@ -716,6 +745,8 @@ if (wantShifts) { m_pianoRollShifts.push_back(activeShifts); } + + return filtered; } Vamp::Plugin::FeatureList diff -r 71bef111e130 -r 19fd6cb033c7 src/Silvet.h --- a/src/Silvet.h Fri Aug 08 11:54:54 2014 +0100 +++ b/src/Silvet.h Wed Oct 15 17:40:20 2014 +0100 @@ -92,9 +92,9 @@ Grid preProcess(const Grid &); - void postProcess(const vector &pitches, - const vector &bestShifts, - bool wantShifts); // -> piano roll column + vector postProcess(const vector &pitches, + const vector &bestShifts, + bool wantShifts); // -> piano roll column FeatureList noteTrack(int shiftCount); @@ -118,6 +118,7 @@ mutable int m_notesOutputNo; mutable int m_fcqOutputNo; + mutable int m_pitchOutputNo; }; #endif