you can find a little abstraction example (bonkbeat~-ex.pd) in the following zip file to detect the bpm of an incomming signal : http://uas.surlaplage.org/bonkbeat.zip
its part of bigger unreleased set
if you want to detect peaks, just use bonk~ by itslef
tof