Re/sampled loop sync

have a look at this thread, possibly some inspiration if nothing else