Mercurial > hg > vamp-tempogram
comparison TempogramPlugin.cpp @ 24:957b83524c06
* Replacing loop unsigned ints with ints
author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
---|---|
date | Tue, 19 Aug 2014 18:20:26 +0100 |
parents | 7d36c742a183 |
children | fe23998968b4 |
comparison
equal
deleted
inserted
replaced
23:7d36c742a183 | 24:957b83524c06 |
---|---|
383 | 383 |
384 // Real initialisation work goes here! | 384 // Real initialisation work goes here! |
385 m_inputBlockSize = blockSize; | 385 m_inputBlockSize = blockSize; |
386 m_inputStepSize = stepSize; | 386 m_inputStepSize = stepSize; |
387 | 387 |
388 //m_spectrogram = Spectrogram(m_inputBlockSize/2 + 1); | |
388 if (!handleParameterValues()) return false; | 389 if (!handleParameterValues()) return false; |
389 //cout << m_cyclicTempogramOctaveDivider << endl; | 390 //cout << m_cyclicTempogramOctaveDivider << endl; |
390 | 391 |
391 return true; | 392 return true; |
392 } | 393 } |
412 float magnitude = sqrt(in[2*i] * in[2*i] + in[2*i + 1] * in[2*i + 1]); | 413 float magnitude = sqrt(in[2*i] * in[2*i] + in[2*i + 1] * in[2*i + 1]); |
413 magnitude = magnitude > m_noveltyCurveMinDB ? magnitude : m_noveltyCurveMinDB; | 414 magnitude = magnitude > m_noveltyCurveMinDB ? magnitude : m_noveltyCurveMinDB; |
414 fftCoefficients.push_back(magnitude); | 415 fftCoefficients.push_back(magnitude); |
415 } | 416 } |
416 m_spectrogram.push_back(fftCoefficients); | 417 m_spectrogram.push_back(fftCoefficients); |
418 //m_spectrogram.push_back(fftCoefficients); | |
417 | 419 |
418 return FeatureSet(); | 420 return FeatureSet(); |
419 } | 421 } |
420 | 422 |
421 TempogramPlugin::FeatureSet | 423 TempogramPlugin::FeatureSet |
432 //initialise novelty curve processor | 434 //initialise novelty curve processor |
433 int numberOfBlocks = m_spectrogram.size(); | 435 int numberOfBlocks = m_spectrogram.size(); |
434 //cerr << numberOfBlocks << endl; | 436 //cerr << numberOfBlocks << endl; |
435 NoveltyCurveProcessor nc(m_inputSampleRate, m_inputBlockSize, m_noveltyCurveCompressionConstant); | 437 NoveltyCurveProcessor nc(m_inputSampleRate, m_inputBlockSize, m_noveltyCurveCompressionConstant); |
436 vector<float> noveltyCurve = nc.spectrogramToNoveltyCurve(m_spectrogram); //calculate novelty curvefrom magnitude data | 438 vector<float> noveltyCurve = nc.spectrogramToNoveltyCurve(m_spectrogram); //calculate novelty curvefrom magnitude data |
437 //if(noveltyCurve.size() > 50) for (int i = 0; i < 50; i++) cerr << noveltyCurve[i] << endl; | |
438 | 439 |
439 //push novelty curve data to featureset 1 and set timestamps | 440 //push novelty curve data to featureset 1 and set timestamps |
440 for (int i = 0; i < numberOfBlocks; i++){ | 441 for (int i = 0; i < numberOfBlocks; i++){ |
441 Feature noveltyCurveFeature; | 442 Feature noveltyCurveFeature; |
442 noveltyCurveFeature.values.push_back(noveltyCurve[i]); | 443 noveltyCurveFeature.values.push_back(noveltyCurve[i]); |