Trying to generate an impulse when signal passes through discrete values in a list
hello everyone!
Super new to max msp and trying to build a simple rhythm generator based on a string of integers.
The goal is for a string like [2 4 12 16] to produce a trigger on each of those beats.
So far I have made a step counter using a phasor~ with a sample and hold. I am stuck trying to output a click or impluse when/if the sample and hold output is equal to more than just one specific value.

In this example an impulse is generated when the signal reaches ~3.
is it poossible to have an impulse when said signal reaches lets say 1, 3, 7, 9, 11 and12 without having to fan out the patch into streams for each value?
Thanks a bunch!
Dylan.
Hi Dylan,
Using the structure you have built, I added a select (sel) object which bangs when equal to the set arguments, and I connected it to a click~ object which sends impulses. I used your example of sending impulses when the signal reaches 1, 3, 7, 9, 11 and 12. I hope this helps. I've attached the patch below:
Best,
Jake
delta and sah and then measuring at 0.5 instead of 1 to 0 transition seems right.
but you can also measure at the transition, simply like that:
[phasor~]
[delta~]
[!-~ 0.]
Thank you for your response Jake! :)
yes this is more or less what im trying to do, although I think this process leads to some considerable timing inaccuracy. As the sample rate signal is being converted to a float, then to a msp message, then back to up sample rate the new click is sometimes almost half a beat behind the actual clock.
I'd love to know if there is a solution in the sample rate domain for more than one value?

Thanks for the tip Roman! i was struggling to get transition reading at exactly 0
Best,
Dylan
I would check out this page, which describes using phasor for timing purposes. It might have information that could help you. Why are you looking to build a rhythm generator in the sample rate domain? Another thought I had is to use global transport and transport, and have the setup trigger events at certain bars/beats/ticks.
this is page is really helpful thanks!
i think you are right, i should probably just be using a counter driven by edge~.
I just really like the signal workflow and was hoping to stay there.
and forget his bang stuff. if you use signal, then only use signal.