[Max 5] extract trigger to bang a function

cebec's icon

Ok, I need some help with this. I'm hoping there's a way I can get tighter timing.

Here's what I'm trying to do. I want to extract a trigger from a signal coming in via the adc~ and use that to bang two functions which control amplitude and playback position of a buffer which is also recording the signal (coming in via the adc~).

However, the 'domain' of the function should match the time between triggers and update dynamically so that the functions are being banged in time with the recorded signal.

The problem I'm experiencing, which I seemed to experience to a lesser degree in Max 4.6 is difficult to describe. I've attached a test patch for your consideration.

In this patch, the click~ plays the role of the extracted trigger AND the signal to be recorded into a buffer. Theoretically, this will provide the tightest possible scenario. The time between triggers is measured with a timer and that time is used to set the buffer~ size, record~ end point in ms, and both functions' domain.

One side note: I'm not sure why the extracted domain, 275 ms, is not reflected properly in the select end ms, display length ms, or the domain (Y coordinate of the 'pos' function). This is an issue I've experienced in other patches, as well.

cebec's icon

Here's a slightly cleaner version with the 'size' message connected and an edge/timer combo at the output.
Sometimes I get good timing, and other times, I don't. I don't know why. When I first start the patch, the timing is terrible but then seems to settle down or requires that I restart the metro or reset the record~ object.