# HG changeset patch # User Carl Bussey # Date 1408468826 -3600 # Node ID 957b83524c06e66419bbb8fcc4c228c1b718e91f # Parent 7d36c742a18361eebc25b45fa70cff6ebb7c9e75 * Replacing loop unsigned ints with ints diff -r 7d36c742a183 -r 957b83524c06 NoveltyCurveProcessor.cpp --- a/NoveltyCurveProcessor.cpp Tue Aug 19 17:40:10 2014 +0100 +++ b/NoveltyCurveProcessor.cpp Tue Aug 19 18:20:26 2014 +0100 @@ -113,13 +113,14 @@ } //half rectification (set negative to zero) -void NoveltyCurveProcessor::halfWaveRectify(SpectrogramTransposed &spectrogramTransposed) const +void NoveltyCurveProcessor::halfWaveRectify(Spectrogram &spectrogram) const { - int numberOfBlocks = spectrogramTransposed[0].size(); + int length = spectrogram.size(); + int height = spectrogram[0].size(); - for (int block = 0; block < numberOfBlocks; block++){ - for (int k = 0; k < (int)m_blockSize; k++){ - if (spectrogramTransposed[k][block] < 0.0) spectrogramTransposed[k][block] = 0.0; + for (int i = 0; i < length; i++){ + for (int j = 0; j < height; j++){ + if (spectrogram[i][j] < 0.0) spectrogram[i][j] = 0.0; } } } @@ -140,7 +141,7 @@ if(normaliseScale != 0.0) spectrogramTransposed[k][block] /= normaliseScale; //normalise } } - + //smooted differentiator smoothedDifferentiator(spectrogramTransposed, 5); //make smoothLength a parameter! //halfwave rectification diff -r 7d36c742a183 -r 957b83524c06 SpectrogramProcessor.cpp --- a/SpectrogramProcessor.cpp Tue Aug 19 17:40:10 2014 +0100 +++ b/SpectrogramProcessor.cpp Tue Aug 19 18:20:26 2014 +0100 @@ -61,11 +61,11 @@ { Spectrogram spectrogram; - unsigned int readBlockPointerIndex = 0; - unsigned int writeBlockPointer = 0; + int readBlockPointerIndex = 0; + int writeBlockPointer = 0; //cout << m_hopSize << endl; - while(readBlockPointerIndex <= inputLength) { + while(readBlockPointerIndex <= (int)inputLength) { int readPointer = readBlockPointerIndex - m_windowLength/2; for (int n = 0; n < (int)m_windowLength; n++){ diff -r 7d36c742a183 -r 957b83524c06 TempogramPlugin.cpp --- a/TempogramPlugin.cpp Tue Aug 19 17:40:10 2014 +0100 +++ b/TempogramPlugin.cpp Tue Aug 19 18:20:26 2014 +0100 @@ -385,6 +385,7 @@ m_inputBlockSize = blockSize; m_inputStepSize = stepSize; + //m_spectrogram = Spectrogram(m_inputBlockSize/2 + 1); if (!handleParameterValues()) return false; //cout << m_cyclicTempogramOctaveDivider << endl; @@ -414,6 +415,7 @@ fftCoefficients.push_back(magnitude); } m_spectrogram.push_back(fftCoefficients); + //m_spectrogram.push_back(fftCoefficients); return FeatureSet(); } @@ -434,7 +436,6 @@ //cerr << numberOfBlocks << endl; NoveltyCurveProcessor nc(m_inputSampleRate, m_inputBlockSize, m_noveltyCurveCompressionConstant); vector noveltyCurve = nc.spectrogramToNoveltyCurve(m_spectrogram); //calculate novelty curvefrom magnitude data - //if(noveltyCurve.size() > 50) for (int i = 0; i < 50; i++) cerr << noveltyCurve[i] << endl; //push novelty curve data to featureset 1 and set timestamps for (int i = 0; i < numberOfBlocks; i++){