comparison plugins/SimilarityPlugin.cpp @ 67:e8e103090d97

* Probable fix to beat spectrum calculation in chroma+rhythm mode -- will review this in a moment and commit some tidying
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 05 Mar 2008 12:17:44 +0000
parents 12516e68c81e
children 68f181553123
comparison
equal deleted inserted replaced
66:12516e68c81e 67:e8e103090d97
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 2
3 /* 3 /*
4 * SegmenterPlugin.cpp 4 * SimilarityPlugin.cpp
5 * 5 *
6 * Copyright 2008 Centre for Digital Music, Queen Mary, University of London. 6 * Copyright 2008 Centre for Digital Music, Queen Mary, University of London.
7 * All rights reserved. 7 * All rights reserved.
8 */ 8 */
9 9
222 222
223 if (m_fftSize != 2048) { 223 if (m_fftSize != 2048) {
224 std::cerr << "WARNING: SimilarityPlugin::initialise: Internal processing FFT size " << m_fftSize << " != expected size 2048 in chroma mode" << std::endl; 224 std::cerr << "WARNING: SimilarityPlugin::initialise: Internal processing FFT size " << m_fftSize << " != expected size 2048 in chroma mode" << std::endl;
225 } 225 }
226 226
227 // std::cerr << "fftsize = " << m_fftSize << std::endl; 227 std::cerr << "fftsize = " << m_fftSize << std::endl;
228 228
229 m_rhythmClipFrameSize = m_fftSize / 4; 229 m_rhythmClipFrameSize = m_fftSize / 4;
230 230
231 // m_rhythmClipFrameSize = m_fftSize / 16; 231 // m_rhythmClipFrameSize = m_fftSize / 16;
232 // while (m_rhythmClipFrameSize < 512) m_rhythmClipFrameSize *= 2; 232 // while (m_rhythmClipFrameSize < 512) m_rhythmClipFrameSize *= 2;
233 233
234 // std::cerr << "m_rhythmClipFrameSize = " << m_rhythmClipFrameSize << std::endl; 234 std::cerr << "m_rhythmClipFrameSize = " << m_rhythmClipFrameSize << std::endl;
235 235
236 // std::cerr << "min = "<< config.min << ", max = " << config.max << std::endl; 236 std::cerr << "min = "<< config.min << ", max = " << config.max << std::endl;
237 237
238 } else { 238 } else {
239 239
240 std::cerr << "SimilarityPlugin::initialise: internal error: unknown type " << m_type << std::endl; 240 std::cerr << "SimilarityPlugin::initialise: internal error: unknown type " << m_type << std::endl;
241 return false; 241 return false;
243 243
244 if (needRhythm()) { 244 if (needRhythm()) {
245 m_rhythmClipFrames = 245 m_rhythmClipFrames =
246 int(ceil((m_rhythmClipDuration * m_processRate) 246 int(ceil((m_rhythmClipDuration * m_processRate)
247 / m_rhythmClipFrameSize)); 247 / m_rhythmClipFrameSize));
248 // std::cerr << "SimilarityPlugin::initialise: rhythm clip requires " 248 std::cerr << "SimilarityPlugin::initialise: rhythm clip requires "
249 // << m_rhythmClipFrames << " frames of size " 249 << m_rhythmClipFrames << " frames of size "
250 // << m_rhythmClipFrameSize << " at process rate " 250 << m_rhythmClipFrameSize << " at process rate "
251 // << m_processRate << " ( = " 251 << m_processRate << " ( = "
252 // << (float(m_rhythmClipFrames * m_rhythmClipFrameSize) / m_processRate) << " sec )" 252 << (float(m_rhythmClipFrames * m_rhythmClipFrameSize) / m_processRate) << " sec )"
253 // << std::endl; 253 << std::endl;
254 254
255 MFCCConfig config(m_processRate); 255 MFCCConfig config(m_processRate);
256 config.fftsize = m_rhythmClipFrameSize; 256 config.fftsize = m_rhythmClipFrameSize;
257 config.nceps = m_featureColumnSize - 1; 257 config.nceps = m_rhythmColumnSize - 1;
258 config.want_c0 = true; 258 config.want_c0 = true;
259 config.logpower = 1; 259 config.logpower = 1;
260 config.window = RectangularWindow; // because no overlap 260 config.window = RectangularWindow; // because no overlap
261 m_rhythmfcc = new MFCC(config); 261 m_rhythmfcc = new MFCC(config);
262 } 262 }