comparison src/Silvet.h @ 336:d25e4aee73d7 livemode

Add onset+offset output; look up shift counts rather than passing them around
author Chris Cannam
date Fri, 26 Jun 2015 10:23:54 +0100
parents 4cf4313d7e30
children 3c6f5d2d33e8 705d807ca2ca
comparison
equal deleted inserted replaced
335:d861f86f2b17 336:d25e4aee73d7
108 set<int> m_current; 108 set<int> m_current;
109 109
110 Grid preProcess(const Grid &); 110 Grid preProcess(const Grid &);
111 111
112 std::pair<vector<double>, vector<int> > applyEM(const InstrumentPack &pack, 112 std::pair<vector<double>, vector<int> > applyEM(const InstrumentPack &pack,
113 const vector<double> &column, 113 const vector<double> &column);
114 bool wantShifts);
115 114
116 void postProcess(const vector<double> &pitches, 115 void postProcess(const vector<double> &pitches,
117 const vector<int> &bestShifts, 116 const vector<int> &bestShifts); // -> piano roll column
118 bool wantShifts); // -> piano roll column
119 117
120 std::pair<FeatureList, FeatureList> noteTrack(int shiftCount); // notes, onsets 118 struct FeatureChunk {
119 FeatureList notes;
120 FeatureList onsets;
121 FeatureList onOffsets;
122 };
121 123
122 void emitNote(int start, int end, int note, int shiftCount, 124 int getShiftCount() const;
125
126 FeatureChunk noteTrack(); // notes, on/offsets
127
128 void emitNote(int start, int end, int note,
123 FeatureList &noteFeatures); 129 FeatureList &noteFeatures);
124 130
125 void emitOnset(int start, int note, int shiftCount, 131 void emitOnset(int start, int note,
126 FeatureList &noteFeatures); 132 FeatureList &onOffsetFeatures);
133
134 void emitOffset(int start, int end, int note,
135 FeatureList &onOffsetFeatures);
127 136
128 Vamp::RealTime getColumnTimestamp(int column); 137 Vamp::RealTime getColumnTimestamp(int column);
129 138
130 Feature makeNoteFeature(int start, int end, int note, int shift, 139 Feature makeNoteFeature(int start, int end, int note, int shift, double strength);
131 int shiftCount, double strength); 140 Feature makeOnsetFeature(int start, int note, int shift, double strength);
132 Feature makeOnsetFeature(int start, int note, int shift, 141 Feature makeOffsetFeature(int col, int note, int shift);
133 int shiftCount, double strength);
134 142
135 int getVelocityFor(double strength, int column); 143 int getVelocityFor(double strength, int column);
136 144
137 float getInputGainAt(Vamp::RealTime t); 145 float getInputGainAt(Vamp::RealTime t);
138 146
139 void insertTemplateFeatures(FeatureSet &); 147 void insertTemplateFeatures(FeatureSet &);
140 148
141 void transcribe(const Grid &, FeatureSet &); 149 void transcribe(const Grid &, FeatureSet &);
142 150
143 string getChromaName(int n) const; 151 string getChromaName(int n) const;
144 string getNoteName(int n, int shift, int shiftCount) const; 152 string getNoteName(int n, int shift) const;
145 float getNoteFrequency(int n, int shift, int shiftCount) const; 153 float getNoteFrequency(int n, int shift) const;
146 154
147 int m_blockSize; 155 int m_blockSize;
148 int m_columnCount; 156 int m_columnCount;
149 int m_resampledCount; 157 int m_resampledCount;
150 Vamp::RealTime m_startTime; 158 Vamp::RealTime m_startTime;
151 bool m_haveStartTime; 159 bool m_haveStartTime;
152 160
153 mutable int m_notesOutputNo; 161 mutable int m_notesOutputNo;
154 mutable int m_onsetsOutputNo; 162 mutable int m_onsetsOutputNo;
163 mutable int m_onOffsetsOutputNo;
155 mutable int m_fcqOutputNo; 164 mutable int m_fcqOutputNo;
156 mutable int m_pitchOutputNo; 165 mutable int m_pitchOutputNo;
157 mutable int m_templateOutputNo; 166 mutable int m_templateOutputNo;
158 mutable int m_chromaOutputNo; 167 mutable int m_chromaOutputNo;
159 }; 168 };