changeset 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
files NoveltyCurveProcessor.cpp SpectrogramProcessor.cpp TempogramPlugin.cpp
diffstat 3 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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++){
--- 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<float> 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++){