synchronizing rewire devices with the rest of the patch

mikex's icon

Hi,
I am trying to build very simle rewire host with sync. For my testing purposes I am using Reason connected to max/msp via rewire~. The aim is to sync reason and other devices within the patch. I have build a simple sampler that takes 2 seconds from rewire~ output (bpm is set to 120 so it coresponds with one 4/4 bar). Rewire is getting his tempo and Midi clock from sync~. When record~ is set to loop and started at the same time with Reason via simple bang everything works fine...

Problem: I would like to tell record~ when to start recording a bar of sound from reason and when done, let groove~ to play it in the loop still in the sync with Reason. Reason actually doesn't send back any information through rewire about it's current position. What I tried is to put a simple 'counter' on Midiclock messages from sync~ (96 per Bar) and connected it to 'onebang' in this case bang for recording is supposed to go through only if Reason is starting new bar... but some latency occours, bars are not at sync...

What is the common way to synchronize devices in max/msp? how can you take care of latency (if it is the case)?

Thank you

Martin

umma08's icon

does anybody have an answer for this. there seems to be so many threads on the same sort of topic - but no distinct answer?