Change tempo of metro immediately?
This seems like a classic in the forums, but I have yet to find a definitive answer: Is there a way to make the metro object change its tempo (almost) immediately upon receiving a new tempo value?
As it is now, it waits until the next "tick" before changing tempo, which is kind of long if you have a tempo of, say, 1000. Some suggested the tempo object would react immediately upon a new tempo value, but as far as I can tell, it also waits until the next value.
If you send a bang to tempo right after you change its speed, then it will restart with the right tempo.
I tried that, but that becomes very messy when you are changing the tempo with a slider. I’d rather avoid the re-trig, but it seems that might be difficult.
sorry not to be more help but I recall that someone (?) recently posted a patch in relation to a ‘bang’ timing/quantizing issue, which used the delay object in a novel/unique way; kind of like a sample-and-hold effect. Maybe you could trawl the forum for that? You could use the delay object to quantize bangs from your slider+trigger.
If you are willing to go into the signal domain, train~ has the behavior that you search for.
to change the speed immediately you simply need to stop and restart it.
i´d use a [t 1 f 0] for that job.
Here’s an absurdly hard way:
----------begin_max5_patcher---------- 643.3ocyV0saaBCF8ZxSgkulUgsSLvtXR64XZpBBtotBrQfSW1p5697OPS5D g3RHzcCV1X+4y478i+dYU.LWdf0BAeE7CPPvKqBBrKYVHnad.rJ6v1xrV61f 46UJo.F59kbupjoT+tl4rALOSrCB9Y2u4E1yHye5KnM8moNSs8QtX28MrsJ2 wHo36hBADbpY.G0+8MCI1WwE5axhAzwEc2uaUyhutZk4SnmjQv9kFa8.SwNX wCTA3fb.+rjjKTvvNtF5lNHkw8V3AoPIxprmG98FdV4XhQRrg+nDpYXM0Owv bEs7+XuBjQMGRiHSQi1WkyZ7RKFTDPSRDVG4DAJxLrI5pDg5rF88pXM2yDY4 k1eOr.gmf.0VxKFQfFTUR8f5QI1AG2WStD2Gij8ZBNJJ5LgFyX5SKqDfFuBQ 3YzkjIlwfuaiN9H0V9fbgLF7GIiAOexx2.oooilGMjhDeUJBkXCdPynhLm0Y 4Uij37PoLSc1HE5UoKXatEI9SNRYpOlN1aoXL045WaHWRZ+2a8aoJ4tc5pNe z3axXTwU8uqRnusE3e09YLTVegMR86TQSnynIEIiIIF2bWWBzM2nLbq4fkbw +1knERl0euV0J22rsmxcUzAGAUAqUwEYJtNp+3dL8FdxldjWTvDm51J3sFOo UyhFzo4KbL8jAPW.Oz2smaNbvW.NwKGbP93svKq25h3YwjmTePCZwTmDOEmw PSEunVpqM2kcS13dRj55ghfcCcUWnmNy0lEh5pJuN4sYGQzrwzXOXZxho6TO PS7xki3AZn+WglkqZOYFxPNGZbuLlUW+LqosyjVfn6W3IYiYJMzNkKbSsMn. aXOy62u1dZq85p+BMlv9ZB -----------end_max5_patcher-----------
Thanks for the suggestions, Roman and mzed, but Roman – your example still means there will be an extra trigger every time the slider slides from one tempo to another (resulting in lots "extra triggers"), and mzed, you are definitely the closest to getting this to work, but it seems there are some inconsistencies, resulting in the trigger not always immediately catching on to the tempo change.
With the metro object, you are going to have either one problem or the other. You need to "debounce" the slider input in some way, which will inevitably introduce some latency.
I wrote an elaborate solution called tempo~ that is in the cnmat downloads: http://cnmat.berkeley.edu/downloads It uses phasor~ as the timing mechanism. As jvkr says, train~ will also work.