Getting samples of differing lengths/BPMs to play in time
I've got one buffer that has a file lasts for 1 beat and the second buffer has a file that lasts for 1 bar at 115bpm.
I am trying to program it so when I start looping them at the same time, both samples are in time together relative to the global tempo. For 1 beat samples it's easy - Just set up the tempo clock and send a bang each beat to play it.
For a sample that lasts longer than 1 beat it has to be slowed down or sped up depending on its tempo right? I need to program it so that it starts on the first beat of a bar and finishes before the first beat of the next bar, relative to the global tempo.
So in my example, the second sample lasts for 1 bar at 115 bpm. But my global tempo is 130bpm so I need to find a way to getting my second sample sped up so it's precisely at 130bpm. If I then change the global tempo, I want my samples to be adjusted as necessary.
I hope that's clear enough. Can anyone weigh in? Thanks! :)
One way is to build a phasor~ synchronised system linked to the transport. Much better to drive something like this with signals rather than Max messages.