simplified beat tracker code