mtr and long files

felipe vaz's icon

Could someone enlighten me on how to properly sync a mtr with a long audio file? I have a 25-minute long stereo wav file (using a sfplay~), and I captured 5 tracks of gestures with mtr, but I cannot get them to sync when playing back. I see the mtr file is somewhat heavy (29 MB in old mtr txtfile format), but there's a significant time difference no matter if I use mtr with @sync or not. I also found a recommendation in the forum about turning overdrive off, but it didn't help.

I thought of using audio buffers, but this would mean huge files which are not practical since this will be used on a computer to which I don't have direct access.

Any help is appreciated. Thanks!

Max Patch
Copy patch and select New From Clipboard in Max.

felipe vaz's icon

All in all I solved it by recording a 5-channel wav file directly to disk, using sig~ and sfrecord~ and formatting it as int8 to keep file sizes smaller. Still a 350MB wav file for less than 25 minutes of gestures, but now timing is perfect (even using separate sfplay~s for sound and data) and it stays mostly under 1% CPU usage.

It is a pity that mtr is not as precise.

David Baldwin's icon

Hi there, I just came across your post and was wondering if you'd be able to explain a bit more about how you were able to sync a long audio file to MTR data. I'm completely new to Max and I'm not a musician or programmer, but I've been tinkering with trying to sync some MTR recorded motion data to a SMPTE LTC audio track and I think your approach could be the answer. Any help (in layman's terms) would be appreciated. Thanks so much!

felipe vaz's icon

Hi David, I ended up completely discarding mtr because of the sync problems.

Here I send you the code I created to record 5 streams of midi CC directly to disk by encoding them as a 5-channel wave file (it is all data, after all), and then retrieve and convert them back to 5 streams of values between 0 and 127. It is a bit of brute force but works just fine. The audio file started at the same time and played in parallel and kept sync perfectly although they were separate files/objects. I hope it helps you.

Max Patch
Copy patch and select New From Clipboard in Max.

David Baldwin's icon

Thanks, Felipe! I'm going to have to study this to make sure I can wrap my head around it. I really appreciate you sharing! Fingers crossed, hoping this approach will work for me as well. Take care!