tempo calculation