Mercurial > audlegacy-plugins
view src/paranormal/beatdetect.c @ 170:13955c70fbec trunk
[svn] - split out beat detection code into beatdetect.c
| author | nenolod |
|---|---|
| date | Tue, 31 Oct 2006 23:13:49 -0800 |
| parents | |
| children | 65c4d8591b4a |
line wrap: on
line source
#include "paranormal.h" int pn_is_new_beat(void) { /* quantize the average energy of the pcm_data for beat detection. */ int fftsum = ((pn_sound_data->pcm_data[0][0] + pn_sound_data->pcm_data[1][0]) >> 6); /* * if the energy's quantization is within this, trigger as a detected * beat, otherwise don't. */ return (fftsum >= 300 && fftsum <= 600) ? 1 : 0; }
