Using gen to measure to time between impulses

Sep 20, 2012 at 9:44am

Using gen to measure to time between impulses

I’m trying to make a gen patch that will report the time delay between two impulses arriving (I’m using piezo’s on a table and in theory when bonked the mic closest to the physical source of the impulse should receive it soonest). I found this on making a latch function which is useful

http://cycling74.com/forums/topic.php?id=41908

Any advice on how to use gen to measure the time between when two signals go high?

#64434
Sep 20, 2012 at 10:42pm

A sample counter can be created with [accum 1]. This will output a signal that increases by one for each sample passed. The trick is to reset this counter when the first impulse occurs, and read the output when the second impulse occurs. The [accum] operator resets when it receives a nonzero value to the right-most inlet, so that part is pretty easy. Capturing (and holding) the count at the second impulse can be done with a [sah], or a combination of [history] and [?].

#232423

You must be logged in to reply to this topic.