Naive Drum-detection

Algorithm (pseudo):

for (i=0;i<bands;i++)
   for (j=0;j<length_of_band;j++) {
      if (sgram[i][j] > dBThreshold) {
         if ((sgram[i][j] - prev_sgram_value) > dbClimbThreshold) regHit(j);
   }
}
  
traverses_hits {
   if (hits_at_same_time > hitThreshhold) regDrum(time);
}
Here you can see a spectrogram (using Hamming window) of the sample testbeat.wav that I'm using to detect when a drum has been hit. I'm using fftw, bins=512, 50% overlapping (or whatever it's called)
The yellow lines shows the detected drumstarts my algorithm finds. I'm using a dBThreshold (everyting below is ignored) of -54dB, I've set the dBClimbThreshold (the amount of change in power in a band) to 20dB and for a line to appear there has to be 5% hits (ie. we have here 256bands, 5% hits means we'll have to have a 20dB change in dB above -54dB in 5% of the bands at that moment)

As we can see, some of the yellow lines are wider than others, this is because it's actually 2 or 3 lines adjacent to eachother beacause of bad detection by the algorithm

The algorithm also fails to detect some drums alltogether (look in the right corner at the very end for example)
Here some red lines are added, these lines are analysis of the yellow lines trying to detect in which freq-spectrum the drum propably spans. Only using the yellow lines to determine this might not be possible because the 'attack' of different frequencies in the same drum is not the same.
espenr@ii.uib.no, 07.10.99