ddf / Minim

A Java audio library, designed to be used with Processing.
http://code.compartmental.net/tools/minim
GNU Lesser General Public License v3.0
668 stars 136 forks source link

Beat detection from PCM #90

Open levuphuong opened 5 years ago

levuphuong commented 5 years ago

Hi

The input is pcm wave data 8 bit, Sample rate 44100, time size 1024. I use sound energy algorithm but detection is not correct. And I have confusion with Variance. What is maximum of V? following the library V-max = 255^2. It would impact to C constant value too much. C = (-0.0025714f * V) + 1.5142857f;

https://github.com/ddf/Minim/blob/master/src/main/java/ddf/minim/analysis/BeatDetect.java

Thanks

ddf commented 5 years ago

This is very old code and was never really good as a general purpose beat detection method. It worked reasonably well on music is strong beats (dance music for instance). I don't recall exactly how it all works, but after looking over the code again, I'm pretty sure that V will never get so large. It should be the average amount that samples in the current buffer differ from the average value of the entire buffer, so I would expect it to every be larger than 2.

Can you be more specific about how the detection is "not correct"?