Hi there!
I’m quite new to pd but getting more and more into it as I’m trying to build a simple game/app, where users must trigger sound-samples in a certain order and (most notably) at certain points in time. The samples are triggered with bangs and since I edited them by myself, I know the exact length of every sample.
Now let us assume we have 4 samples, each of them with a length of 1200ms and each sample has its own bang to trigger it. These bangs get their input from „buttons“ which the user can hit via a graphical user interface (I built this GUI with MOBMUPLAT, a GUI-editor which interacts with Pd patches). If the bangs are triggered with exact timing, the 4 samples will add up to a musical sequence.
The first bang starts sample1 - after 1200ms the second bang (= button on the interface) shall be hit to start sample2 and so on.. it’s obvious that the user will not hit the buttons on the interface with an accuracy of single milliseconds, so here are my questions for the pd patch:
-
How can I „read out“ certain points in time, after a bang got triggered? e.g. after the first bang was hit, how much time (in ms) has passed until the second bang got hit? And can I „store“ and „recall“ these values in any way?
-
Is it possible to define a kind of „time window“ in ms? e.g. after the first bang was hit, the second bang has to be hit within 1150-1250ms to trigger something, or else (if the second is triggered too soon/late) nothing will happen..
Hope this explanation of my problem is not too complicated. Any help would be much appreciated!