Completed re-sampling/tempo matching algorithm