# HG changeset patch # User Andrew N Robertson # Date 1335226764 -3600 # Node ID eb43b2a007eaf4311ad9704540a8efcc01651714 # Parent 6fb77b20413c539f69a23b347bd012d690ccd9ee changed newMatchOnset to have different way to calculate onsets vs noise, using the onsetLikelihoodNoise factor diff -r 6fb77b20413c -r eb43b2a007ea bayesianArraySrc/BayesianArrayStructure.cpp --- a/bayesianArraySrc/BayesianArrayStructure.cpp Sun Apr 08 18:59:30 2012 +0100 +++ b/bayesianArraySrc/BayesianArrayStructure.cpp Tue Apr 24 01:19:24 2012 +0100 @@ -31,7 +31,9 @@ tmpBestEstimate = 0; crossUpdateTimeThreshold = 60; - priorWidth = 8; + priorWidth = 12; + + } @@ -57,6 +59,7 @@ posterior.createVector(length); acceleration.createVector(length); + printf("scalar %f\n", posterior.scalar); } @@ -104,8 +107,10 @@ int index = relativeSpeedPosterior.getRealTermsAsIndex(speedPriorValue); relativeSpeedPosterior.zero(); relativeSpeedPosterior.addGaussianShape(index, priorWidth, 0.9); + relativeSpeedPosterior.addGaussianShape(relativeSpeedPosterior.getRealTermsAsIndex(1), 4, 1); + printf("speed adding to index for 1 = %f\n", relativeSpeedPosterior.getRealTermsAsIndex(1)); - relativeSpeedPosterior.addToIndex(relativeSpeedPosterior.getRealTermsAsIndex(1), 0.5); +// relativeSpeedPosterior.addToIndex(relativeSpeedPosterior.getRealTermsAsIndex(1), 0.5); //relativeSpeedPosterior.addGaussianShapeFromRealTime(1, 3, 0.5); @@ -130,6 +135,7 @@ prior.scalar = f; posterior.scalar = f; likelihood.scalar = f; + printf("SET POS DISTBN SCALAR %f\n", f); } } diff -r 6fb77b20413c -r eb43b2a007ea bayesianArraySrc/DynamicVector.cpp --- a/bayesianArraySrc/DynamicVector.cpp Sun Apr 08 18:59:30 2012 +0100 +++ b/bayesianArraySrc/DynamicVector.cpp Tue Apr 24 01:19:24 2012 +0100 @@ -16,7 +16,7 @@ maximumValue = 0; MAPestimate = 0; offset = 0; - scalar = 1; + scalar = 6; integratedEstimate = length/2; gaussianLookupMean = (double) GAUSSIAN_LOOKUP_LENGTH/2; diff -r 6fb77b20413c -r eb43b2a007ea src/AudioEventMatcher.cpp --- a/src/AudioEventMatcher.cpp Sun Apr 08 18:59:30 2012 +0100 +++ b/src/AudioEventMatcher.cpp Tue Apr 24 01:19:24 2012 +0100 @@ -10,7 +10,7 @@ #include "AudioEventMatcher.h" -const int matchWindowWidth = 6000; +const int matchWindowWidth = 8000; const float pitchCutOff = 16;//within which pitches are even considered AudioEventMatcher::AudioEventMatcher(){ @@ -21,7 +21,7 @@ chromaLikelihoodToNoise = 0.5;//lower => more noise, higher more weight for events chromaLikelihoodWidth = 50;//ms round onset event - onsetLikelihoodToNoise = 0.4; + onsetLikelihoodToNoise = 0.1; onsetLikelihoodWidth = 10;//in ms setArraySizes(); @@ -59,8 +59,10 @@ bayesianStruct.setSpeedPrior(1.0); bayesianStruct.relativeSpeedPrior.getMaximum(); - bayesianStruct.resetSize(matchWindowWidth); - bayesianStruct.setPositionDistributionScalar(1); + float scalarForBayesianDistribution = 2; + + bayesianStruct.resetSize(matchWindowWidth / scalarForBayesianDistribution); + bayesianStruct.setPositionDistributionScalar(2); } @@ -139,7 +141,7 @@ currentSpeedRatio = 1; temporal.tempoPosterior.zero(); - temporal.tempoPosterior.addGaussianShapeFromRealTime(recordedTempo, 10, 1); + temporal.tempoPosterior.addGaussianShapeFromRealTime(recordedTempo, 2000, 1); //SET TEMPO PRIOR for Speed Ratio //the update this @@ -451,15 +453,15 @@ //start at beginning but OPTIMISE later bayesianStruct.likelihood.offset = bayesianStruct.prior.offset; bayesianStruct.likelihood.zero();//set to zero - - double quantity = 1;//likelihoodToNoiseRatio / numberOfMatches; + //double quantity = 1;// + double quantity = 1*onsetLikelihoodToNoise;//BETTER CHANGE THIS BACK TOO..see below//likelihoodToNoiseRatio / numberOfMatches; int numberOfMatchesFound = 0; double startMatchingTime = bayesianStruct.likelihood.offset; double endMatchingTime = bayesianStruct.likelihood.offset + matchWindowWidth; double millisTime = -1*INFINITY;//or 0 is fine int checkIndex = 0; - if (channel <= recordedTracks.numberOfAudioTracks){ + if (channel <= recordedTracks.numberOfAudioTracks && checkIndex < recordedTracks.loadedAudioFiles[channel].fileLoader.onsetDetect.chromaOnsets.size()){ while (millisTime < startMatchingTime) { millisTime = recordedTracks.loadedAudioFiles[channel].fileLoader.onsetDetect.chromaOnsets[checkIndex].millisTime; checkIndex++; @@ -477,7 +479,8 @@ if (numberOfMatchesFound > 0){ // bayesianStruct.likelihood.addConstant((1-likelihoodToNoiseRatio)/bayesianStruct.likelihood.length); - bayesianStruct.likelihood.addConstant(numberOfMatchesFound*(1-onsetLikelihoodToNoise)/(onsetLikelihoodToNoise*bayesianStruct.likelihood.length)); +// bayesianStruct.likelihood.addConstant(numberOfMatchesFound*(1-onsetLikelihoodToNoise)/(onsetLikelihoodToNoise*bayesianStruct.likelihood.length)); + bayesianStruct.likelihood.addConstant(numberOfMatchesFound*(1-onsetLikelihoodToNoise)/(bayesianStruct.likelihood.length));//BETTER CHANGE THIS BACK... bayesianStruct.likelihood.renormalise(); bayesianStruct.calculatePosterior(); diff -r 6fb77b20413c -r eb43b2a007ea src/RecordedMultitrackAudio.cpp --- a/src/RecordedMultitrackAudio.cpp Sun Apr 08 18:59:30 2012 +0100 +++ b/src/RecordedMultitrackAudio.cpp Tue Apr 24 01:19:24 2012 +0100 @@ -16,7 +16,8 @@ printf("loaded max val is %f\n", loadedAudioFiles[0].fileLoader.onsetDetect.onsetDetector.maximumDetectionValue); - setDifferentMultitracks(13);//command to load this set of audio files - see below + int multitrackToLoad = 13; + setDifferentMultitracks(multitrackToLoad);//command to load this set of audio files - see below //number 7 is problematic with memory @@ -119,7 +120,7 @@ kickfilename = "/Volumes/Supersaurus/Gronk/Gronkn/Bounces/MarbleArchMultitracks/Take6/02Kick_bip.wav"; bassfilename = "/Volumes/Supersaurus/Gronk/Gronkn/Bounces/MarbleArchMultitracks/Take6/01Bass.wav"; snarefilename ="/Volumes/Supersaurus/Gronk/Gronkn/Bounces/MarbleArchMultitracks/Take6/03Snare_bip.wav"; - guitarfilename ="/Volumes/Supersaurus/Gronk/Gronkn/Bounces/MarbleA4chMultitracks/Take6/04Elec_SM57_bip.wav"; + guitarfilename ="/Volumes/Supersaurus/Gronk/Gronkn/Bounces/MarbleArchMultitracks/Take6/04Elec_SM57_bip.wav"; break; @@ -135,7 +136,20 @@ bassfilename = "/Volumes/Supersaurus/Gronk/Gronkn/Bounces/StationGateMultitracks/TakeTwoShorter/01Bass.wav"; snarefilename ="/Volumes/Supersaurus/Gronk/Gronkn/Bounces/StationGateMultitracks/TakeTwoShorter/03Snare_bip.wav"; guitarfilename ="/Volumes/Supersaurus/Gronk/Gronkn/Bounces/StationGateMultitracks/TakeTwoShorter/04Elec_SM57_bip.wav"; - break; + break; + + case 16: + // std::string folder = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/"; + kickfilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/02Kick_D112_bip.wav"; + bassfilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D/01Bass.wav"; + snarefilename = "/Volumes/Supersaurus/SonOfMan/FollowYourLeaders/FollowYourLeaders/Bounces/FollowMultitracks/Follow_023_D//03Snare_Top_bip.wav"; +// guitarfilename ="/Volumes/Supersaurus/Gronk/Gronkn/Bounces/StationGateMultitracks/TakeTwoShorter/04Elec_SM57_bip.wav"; + break; + + + + + } loadAudioTrack(kickfilename, 0); diff -r 6fb77b20413c -r eb43b2a007ea src/testApp.cpp --- a/src/testApp.cpp Sun Apr 08 18:59:30 2012 +0100 +++ b/src/testApp.cpp Tue Apr 24 01:19:24 2012 +0100 @@ -114,6 +114,7 @@ printf("rescue!\n"); eventMatcher.rescue(); } + } } @@ -161,6 +162,10 @@ eventMatcher.recordedTracks.togglePlay(); } + + if (key == 'j'){ + printf("dynamic vector scalar is %f\n", eventMatcher.bayesianStruct.posterior.scalar); + } if (key == OF_KEY_RETURN){