this may be one of those things that are easier to do in C++ than PureData. Using libpd on Bela with a custom render file allows you to get the best of both worlds. Have a look at examples/08-PureData/customRender to see how to use one. You would have to edit the render() function in there to check for the pulses. Remember that you cannot use delay or sleep within render(), rather you will have to count samples , see for instance here