# HG changeset patch # User Chris Cannam # Date 1336641623 -3600 # Node ID ac07c60aa7984c7f913f327fd68fd42daa1b8d76 # Parent e0bfc7b1a094343ceb7fb62be4fc0fe75f1c50f1 Fix typo diff -r e0bfc7b1a094 -r ac07c60aa798 songparts/Makefile.linux64 --- a/songparts/Makefile.linux64 Thu May 10 10:04:46 2012 +0100 +++ b/songparts/Makefile.linux64 Thu May 10 10:20:23 2012 +0100 @@ -1,5 +1,6 @@ -CFLAGS := -O3 -fPIC -ftree-vectorize -I../armadillo-2.4.4/include -I../../vamp-plugin-sdk -I../../qm-dsp +#CFLAGS := -O3 -fPIC -ftree-vectorize -I../armadillo-2.4.4/include -I../../vamp-plugin-sdk -I../../qm-dsp +CFLAGS := -g -fPIC -I../armadillo-2.4.4/include -I../../vamp-plugin-sdk -I../../qm-dsp CXXFLAGS := $(CFLAGS) diff -r e0bfc7b1a094 -r ac07c60aa798 songparts/SongParts.cpp --- a/songparts/SongParts.cpp Thu May 10 10:04:46 2012 +0100 +++ b/songparts/SongParts.cpp Thu May 10 10:20:23 2012 +0100 @@ -50,9 +50,9 @@ // Result Struct typedef struct Part { int n; - vector indices; + vector indices; string letter; - unsigned value; + int value; int level; int nInd; }Part; @@ -1156,7 +1156,7 @@ // padding arma::vec padV = arma::zeros(v.size()+medfilt_length-1); - for (unsigned i=medfilt_length/2; i < medfilt_length/2+v.size(); ++ i) + for (int i=medfilt_length/2; i < medfilt_length/2+v.size(); ++ i) { padV(i) = v(i-medfilt_length/2); } @@ -1164,7 +1164,7 @@ // Median filter arma::vec win = arma::zeros(medfilt_length); - for (unsigned i=0; i < v.size(); ++i) + for (int i=0; i < v.size(); ++i) { win = padV.subvec(i,i+halfWin*2); win = sort(win); @@ -1186,7 +1186,7 @@ x(0) = 0; x(n+1) = 100; - for (unsigned i=1; i parts, arma::vec barline) { arma::uvec nullindices = arma::ones(barline.size()); - for (unsigned iPart=0; iPart 0); - for (unsigned i=0; i &parts) { - for (unsigned iPart=0; iPart newVectorPart; @@ -1278,15 +1278,15 @@ if (parts[iPart].letter.compare("-")==0) { sort (parts[iPart].indices.begin(), parts[iPart].indices.end()); - unsigned newpartind = -1; + int newpartind = -1; vector indices; indices.push_back(-2); - for (unsigned iIndex=0; iIndex 1) { @@ -1311,7 +1311,7 @@ } parts.erase (parts.end()); - for (unsigned i=0; i songSegment(Vamp::Plugin::FeatureList quatisedChromagram) +vector songSegment(Vamp::Plugin::FeatureList quantisedChromagram) { @@ -1334,26 +1334,26 @@ // Collect Info - int nBeat = quatisedChromagram.size(); // Number of feature vector - int nFeatValues = quatisedChromagram[0].values.size(); // Number of values for each feature vector + int nBeat = quantisedChromagram.size(); // Number of feature vector + int nFeatValues = quantisedChromagram[0].values.size(); // Number of values for each feature vector arma::irowvec timeStamp = arma::zeros(1,nBeat); // Vector of Time Stamps // Save time stamp as a Vector - if (quatisedChromagram[0].hasTimestamp) + if (quantisedChromagram[0].hasTimestamp) { - for (unsigned i = 0; i < nBeat; ++ i) - timeStamp[i] = quatisedChromagram[i].timestamp.nsec; + for (int i = 0; i < nBeat; ++ i) + timeStamp[i] = quantisedChromagram[i].timestamp.nsec; } // Build a ObservationTOFeatures Matrix arma::mat featVal = arma::zeros(nBeat,nFeatValues/2); - for (unsigned i = 0; i < nBeat; ++ i) - for (unsigned j = 0; j < nFeatValues/2; ++ j) + for (int i = 0; i < nBeat; ++ i) + for (int j = 0; j < nFeatValues/2; ++ j) { - featVal(i,j) = (quatisedChromagram[i].values[j]+quatisedChromagram[i].values[j+12]) * 0.8; + featVal(i,j) = (quantisedChromagram[i].values[j]+quantisedChromagram[i].values[j+12]) * 0.8; } // Set to arbitrary value to feature vectors with low std @@ -1363,13 +1363,13 @@ arma::mat simmat0 = 1-arma::cor(arma::trans(featVal)); - for (unsigned i = 0; i < nBeat; ++ i) + for (int i = 0; i < nBeat; ++ i) { if (a(i)<0.000001) { featVal(i,1) = 1000; // arbitrary - for (unsigned j = 0; j < nFeatValues/2; ++j) + for (int j = 0; j < nFeatValues/2; ++j) { simmat0(i,j) = 1; simmat0(j,i) = 1; @@ -1380,8 +1380,8 @@ arma::mat simmat = 1-simmat0/2; // -------- To delate when the proble with the add of beat will be solved ------- - for (unsigned i = 0; i < nBeat; ++ i) - for (unsigned j = 0; j < nBeat; ++ j) + for (int i = 0; i < nBeat; ++ i) + for (int j = 0; j < nBeat; ++ j) if (!std::isfinite(simmat(i,j))) simmat(i,j)=0; // ------------------------------------------------------------------------------ @@ -1390,15 +1390,15 @@ // The median filter is for each diagonal of the Matrix arma::mat median_simmat = arma::zeros(nBeat,nBeat); - for (unsigned i = 0; i < nBeat; ++ i) + for (int i = 0; i < nBeat; ++ i) { arma::vec temp = medfilt1(simmat.diag(i),medfilt_length); median_simmat.diag(i) = temp; median_simmat.diag(-i) = temp; } - for (unsigned i = 0; i < nBeat; ++ i) - for (unsigned j = 0; j < nBeat; ++ j) + for (int i = 0; i < nBeat; ++ i) + for (int j = 0; j < nBeat; ++ j) if (!std::isfinite(median_simmat(i,j))) median_simmat(i,j) = 0; @@ -1416,10 +1416,10 @@ potential_duplicates.elem(dup) = arma::ones(dup.size()); potential_duplicates = trimatu(potential_duplicates); - unsigned nPartlengths = round((maxlength-minlength)/4)+1; + int nPartlengths = round((maxlength-minlength)/4)+1; arma::vec partlengths = zeros(nPartlengths); - for (unsigned i = 0; i < nPartlengths; ++ i) + for (int i = 0; i < nPartlengths; ++ i) partlengths(i) = (i*4)+ minlength; // initialise arrays @@ -1428,17 +1428,17 @@ int conta = 0; - //for (unsigned iLength = 0; iLength < nPartlengths; ++ iLength) - for (unsigned iLength = 0; iLength < 20; ++ iLength) + //for (int iLength = 0; iLength < nPartlengths; ++ iLength) + for (int iLength = 0; iLength < 20; ++ iLength) { - unsigned len = partlengths(iLength); - unsigned nUsedBeat = nBeat - len + 1; // number of potential rep beginnings: they can't overlap at the end of the song + int len = partlengths(iLength); + int nUsedBeat = nBeat - len + 1; // number of potential rep beginnings: they can't overlap at the end of the song - for (unsigned iBeat = 0; iBeat < nUsedBeat; ++ iBeat) // looping over all columns (arbitrarily chosen columns) + for (int iBeat = 0; iBeat < nUsedBeat; ++ iBeat) // looping over all columns (arbitrarily chosen columns) { arma::uvec help2 = find(potential_duplicates(span(0,nUsedBeat-1),iBeat)==1); - for (unsigned i=0; i(simArray.n_rows, simArray.n_cols); temp(span::all, span(0,nUsedBeat-1)) = simArray.slice(iLength)(span::all,span(0,nUsedBeat-1)); - for (unsigned i=0; i(decisionArray2.n_rows,decisionArray2.n_cols); - for (unsigned rows=0; rows 0) temp(rows,cols) = 1; arma::vec currLogicSum = arma::sum(temp,1); - for (unsigned iBeat=0; iBeat 1) { arma::vec t = decisionArray2.slice(iLength)(span::all,iBeat); double currSum = sum(t); - unsigned count = 0; - for (unsigned i=0; i0) count++; @@ -1530,7 +1530,7 @@ // make a table of all valid sets of parts char partletters[] = {'A','B','C','D','E','F','G', 'H','I','J','K','L','M','N','O','P','Q','R','S'}; - unsigned partvalues[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; + int partvalues[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; arma::vec valid_sets = arma::ones(bestval.n_rows); if (!bestval.is_empty()) @@ -1539,7 +1539,7 @@ // In questo punto viene introdotto un errore alla 3 cifra decimale arma::colvec t = arma::zeros(bestval.n_rows); - for (unsigned i=0; i(bestval2.n_rows, bestval2.n_cols); - for (unsigned i=0; i(bestIndices.size()); - for (unsigned i=0; i0) bestIndicesMap(i) = 1; arma::rowvec mask = arma::zeros(bestLength*2-1); - for (unsigned i=0; i 0); - for (unsigned i=0; i(s*2-1); - for (unsigned i=0; i(Ind.size()); - for (unsigned i=0; i0) IndMap(i) = 2; @@ -1667,38 +1667,38 @@ -void songSegmentChroma(Vamp::Plugin::FeatureList quatisedChromagram, vector &parts) +void songSegmentChroma(Vamp::Plugin::FeatureList quantisedChromagram, vector &parts) { // Collect Info - int nBeat = quatisedChromagram.size(); // Number of feature vector - int nFeatValues = quatisedChromagram[0].values.size(); // Number of values for each feature vector + int nBeat = quantisedChromagram.size(); // Number of feature vector + int nFeatValues = quantisedChromagram[0].values.size(); // Number of values for each feature vector arma::mat synchTreble = arma::zeros(nBeat,nFeatValues/2); - for (unsigned i = 0; i < nBeat; ++ i) - for (unsigned j = 0; j < nFeatValues/2; ++ j) + for (int i = 0; i < nBeat; ++ i) + for (int j = 0; j < nFeatValues/2; ++ j) { - synchTreble(i,j) = quatisedChromagram[i].values[j]; + synchTreble(i,j) = quantisedChromagram[i].values[j]; } arma::mat synchBass = arma::zeros(nBeat,nFeatValues/2); - for (unsigned i = 0; i < nBeat; ++ i) - for (unsigned j = 0; j < nFeatValues/2; ++ j) + for (int i = 0; i < nBeat; ++ i) + for (int j = 0; j < nFeatValues/2; ++ j) { - synchBass(i,j) = quatisedChromagram[i].values[j+12]; + synchBass(i,j) = quantisedChromagram[i].values[j+12]; } // Process - arma::mat segTreble = arma::zeros(quatisedChromagram.size(),quatisedChromagram[0].values.size()/2); - arma::mat segBass = arma::zeros(quatisedChromagram.size(),quatisedChromagram[0].values.size()/2); + arma::mat segTreble = arma::zeros(quantisedChromagram.size(),quantisedChromagram[0].values.size()/2); + arma::mat segBass = arma::zeros(quantisedChromagram.size(),quantisedChromagram[0].values.size()/2); - for (unsigned iPart=0; iPart newPartVector; vector partindices; - for (unsigned iPart=0; iPart parts; vector finalParts; - parts = songSegment(quatisedChromagram); - songSegmentChroma(quatisedChromagram,parts); + parts = songSegment(quantisedChromagram); + songSegmentChroma(quantisedChromagram,parts); finalParts = songSegmentIntegration(parts); // TEMP ---- - /*for (unsigned i=0;i values; vector letters; - for (unsigned iPart=0; iPart BeatQuantiser(FeatureList chromagram, FeatureList beats); - FeatureList Segmenter(FeatureList quatisedChromagram); + FeatureList Segmenter(FeatureList quantisedChromagram); mutable int m_beatOutputNumber; mutable int m_barsOutputNumber; diff -r e0bfc7b1a094 -r ac07c60aa798 songparts/SongParts.o Binary file songparts/SongParts.o has changed diff -r e0bfc7b1a094 -r ac07c60aa798 songparts/libmain.o Binary file songparts/libmain.o has changed