Did you see
http://code.compartmental.net/minim/beatdetect_class_beatdetect.html
Just measure something between beats