Mercurial > hg > precise-onset-detection
comparison src/PreciseOnsetLocator.cpp @ 8:184a7c232049 tip
changed files since updating computer
author | Venetian |
---|---|
date | Thu, 14 Aug 2014 17:53:57 +0100 |
parents | eb29c6b6dff8 |
children |
comparison
equal
deleted
inserted
replaced
7:b1c13e8bec26 | 8:184a7c232049 |
---|---|
36 for (int i = 0;i < bufferSize;i++) | 36 for (int i = 0;i < bufferSize;i++) |
37 recentBufferSamples[i] = newSamples[i]; | 37 recentBufferSamples[i] = newSamples[i]; |
38 | 38 |
39 } | 39 } |
40 | 40 |
41 int PreciseOnsetLocator::findExactOnset(float* frame){ | |
42 //store the samples - mainly for viewing actually | |
43 onsetSamples.clear(); | |
44 for (int i = 0; i < bufferSize;i++){ | |
45 onsetSamples.push_back(frame[i]); | |
46 } | |
47 return findExactOnset(); | |
48 } | |
49 | |
41 int PreciseOnsetLocator::findExactOnset(double* frame){ | 50 int PreciseOnsetLocator::findExactOnset(double* frame){ |
42 //store the samples - mainly for viewing actually | 51 //store the samples - mainly for viewing actually |
43 onsetSamples.clear(); | 52 onsetSamples.clear(); |
44 for (int i = 0; i < bufferSize;i++){ | 53 for (int i = 0; i < bufferSize;i++){ |
45 onsetSamples.push_back(frame[i]); | 54 onsetSamples.push_back(frame[i]); |
46 } | 55 } |
47 | 56 return findExactOnset(); |
57 } | |
58 | |
59 int PreciseOnsetLocator::findExactOnset(){ | |
48 double energySum = 0; | 60 double energySum = 0; |
49 double lastEnergySum, hopsizeLastEnergySum; | 61 double lastEnergySum, hopsizeLastEnergySum; |
50 double energyDifference; | 62 double energyDifference; |
51 int bestEnergyIndex = 0; | 63 int bestEnergyIndex = 0; |
52 double bestEnergyDifference = 0; | 64 double bestEnergyDifference = 0; |