Added initial attempt at beat detection algorithm, untested