Never ever had a chance to be first up with a comment before, but I know little about algorithms.
But I do know know about rhythms. Will this do?
Edmundo Ros, Rhumbas, Sambas and Tangos. There. I have made a contribution.