Forums > MaxMSP

Converting tempo on hostsync~

November 16, 2008 | 7:43 am

Okay,

Can one convert the tempo output from hostsync into bpm? Is there a way using expr?

Thanks!

- Rich. (Max 4)


November 17, 2008 | 2:11 am

Hey Rich,

Depends on your sample rate. This should show you what you would need to do:

max v2;
#N vpatcher 387 45 987 445;
#P window setfont "Sans Serif" 9.;
#P flonum 252 250 94 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 155 250 94 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 155 177 64 196617 !/ 2646000;
#P newex 252 177 115 196617 expr (2646000. / $f1);
#P flonum 55 250 94 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 55 214 35 196617 * 60.;
#P newex 55 177 55 196617 !/ 44100.;
#P message 158 62 40 196617 26460;
#P message 103 62 40 196617 22050;
#P message 55 62 40 196617 44100;
#P number 55 122 98 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 3 0 0 0;
#P connect 2 0 0 0;
#P connect 1 0 0 0;
#P connect 0 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 0 0 8 0;
#P connect 8 0 9 0;
#P connect 0 0 7 0;
#P connect 7 0 10 0;
#P pop;


November 17, 2008 | 2:14 am

Tiny error in there. The middle inverse division should calculate floats like this:

max v2;
#N vpatcher 387 45 987 445;
#P window setfont "Sans Serif" 9.;
#P flonum 252 250 94 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 155 250 94 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 155 177 67 196617 !/ 2646000.;
#P newex 252 177 115 196617 expr (2646000. / $f1);
#P flonum 55 250 94 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 55 214 35 196617 * 60.;
#P newex 55 177 55 196617 !/ 44100.;
#P message 158 62 40 196617 26460;
#P message 103 62 40 196617 22050;
#P message 55 62 40 196617 44100;
#P number 55 122 98 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 3 0 0 0;
#P connect 2 0 0 0;
#P connect 1 0 0 0;
#P connect 0 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 0 0 8 0;
#P connect 8 0 9 0;
#P connect 0 0 7 0;
#P connect 7 0 10 0;
#P pop;


November 17, 2008 | 5:26 am

Thanks so much, works perfectly. I had noticed on the forum a few users trying to get bpm to match coming out of host applications using rewire – and couldn’t tell why they weren’t just matching this way…

- Rich.


Viewing 4 posts - 1 through 4 (of 4 total)