I'm looking to create (or add-on to) a sophisticated max patch that can follow live midi events and calculate the current tempo. It's easy to make a simple tap tempo follower, but I need it to follow live performance.
My end project will be a live midi looping patch that will record an entire passage and play it back after it's reached the end of a certain number of measures. I'm a multi-instrumentalist and often would like a piano line to continue after I pick up my trumpet, or switch to a synthesizer lead. But this is in context of a band, so it needs to be very accurate as to what tempo it begins playing when I stop.
Currently I'm experimenting with allowing midi notes to be calculated and rounded, but only within a short period of time around where the patch expects the next beat to be. If no note is played, it uses the currently calculated tempo as the beat and keeps going. I'm struggling to code this though, as it's a fairly complex operation. I'm not even completely sure it's the right way of going about this.
Anyone have any thoughts?
I'm thinking someone must have written a really sophisticated tempo follower by this point, better than I'm thinking.