comparison src/AudioEventMatcher.cpp @ 14:0a52258accec

tmp commit
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Sun, 05 Feb 2012 09:58:56 +0000
parents 66783ace7506
children 780def3a1f36
comparison
equal deleted inserted replaced
13:66783ace7506 14:0a52258accec
18 18
19 usingRealTime = false; 19 usingRealTime = false;
20 bayesianStruct.realTimeMode = &usingRealTime; 20 bayesianStruct.realTimeMode = &usingRealTime;
21 recentPitch = 0; 21 recentPitch = 0;
22 currentAlignmentPosition = 0; 22 currentAlignmentPosition = 0;
23
24 onsetLikelihoodWidth = 20;
23 25
24 followingLiveInput = true; 26 followingLiveInput = true;
25 } 27 }
28
26 29
27 void AudioEventMatcher::setWindowDimensions(){ 30 void AudioEventMatcher::setWindowDimensions(){
28 double startHeight = recordedTracks.numberOfAudioTracks * recordedTracks.trackScreenHeight; 31 double startHeight = recordedTracks.numberOfAudioTracks * recordedTracks.trackScreenHeight;
29 double heightAvailable = 1 - startHeight; 32 double heightAvailable = 1 - startHeight;
30 heightAvailable /= 3.0; 33 heightAvailable /= 3.0;
225 bayesianStruct.updateBayesianDistributions(timeIn);//moves the posterior up into prior given the time interval and calculates new offsets 228 bayesianStruct.updateBayesianDistributions(timeIn);//moves the posterior up into prior given the time interval and calculates new offsets
226 229
227 //start at beginning but OPTIMISE later 230 //start at beginning but OPTIMISE later
228 double onsetLikelihoodToNoise = 0.3; 231 double onsetLikelihoodToNoise = 0.3;
229 232
230 double likelihoodWidth = 40;
231
232 bayesianStruct.likelihood.offset = bayesianStruct.prior.offset; 233 bayesianStruct.likelihood.offset = bayesianStruct.prior.offset;
233 bayesianStruct.likelihood.zero();//set to zero 234 bayesianStruct.likelihood.zero();//set to zero
234 235
235 double quantity = 1;//likelihoodToNoiseRatio / numberOfMatches; 236 double quantity = 1;//likelihoodToNoiseRatio / numberOfMatches;
236 int numberOfMatchesFound = 0; 237 int numberOfMatchesFound = 0;
241 242
242 if (channel <= recordedTracks.numberOfAudioTracks){ 243 if (channel <= recordedTracks.numberOfAudioTracks){
243 for (int i = 0;i < recordedTracks.loadedAudioFiles[channel].fileLoader.onsetDetect.chromaOnsets.size();i++){ 244 for (int i = 0;i < recordedTracks.loadedAudioFiles[channel].fileLoader.onsetDetect.chromaOnsets.size();i++){
244 double millisTime = recordedTracks.loadedAudioFiles[channel].fileLoader.onsetDetect.chromaOnsets[i].millisTime; 245 double millisTime = recordedTracks.loadedAudioFiles[channel].fileLoader.onsetDetect.chromaOnsets[i].millisTime;
245 if (millisTime >= startMatchingTime && millisTime <= endMatchingTime){ 246 if (millisTime >= startMatchingTime && millisTime <= endMatchingTime){
246 bayesianStruct.likelihood.addGaussianShapeFromRealTime(millisTime, likelihoodWidth, quantity); 247 bayesianStruct.likelihood.addGaussianShapeFromRealTime(millisTime, onsetLikelihoodWidth, quantity);
247 numberOfMatchesFound++; 248 numberOfMatchesFound++;
248 // printf("Adding Gaussian for onset at time %f offset %f\n", millisTime, bayesianStruct.likelihood.offset); 249 // printf("Adding Gaussian for onset at time %f offset %f\n", millisTime, bayesianStruct.likelihood.offset);
249 250
250 } 251 }
251 } 252 }