precise value of signal to message without precise timing (msp / gen)

R G's icon

Hello,

New here. Apologies for the logic-on-top-of-signal question (I know it's fraught). Thanks in advance for any help.

I have some gen~ patches that do basic amplitude envelope and timbral analysis on a signal. They result values at intervals (usually 50–250 ms) that are dynamically specified as a parameters. The patches sample-and-hold those values until new values are resulted, so the outputs are signal-rate streams of floats that change at the specified intervals.

I want to retrieve those floats as max messages when they cross certain thresholds. I do not need precise timing from those max messages (for my purposes it is okay if they are delayed up to 150 ms); however, I do need the precise values. In other words, I would like the values that trigger the threshold logic gates.

I have tried, for example, [signal] --> [>~ threshold] --> [edge~] --> [snapshot~] but this is often inaccurate, with or without overdrive and interrupt, seemingly as a result of interval / signal vector phasing. Maybe could work if [snapshot~ @offset] had a memory of one signal vector, but even then I'd have to double check the [>~], which seems so inelegant.

If only [>~] or [edge~] could directly pass the value that triggered its logic result as a message...

Is there a way to retrieve these values as messages? In Gen~? Is there an external that can do this? How do signal-to-message objects like peakamp~ or snapshot~ work? How are they made?

One alternative would be to [snapshot~] at the specified reporting intervals and check threshold in message domain, but then my question is: how do I sync the reporting intervals of multiple signal-to-message objects (snapshot~, average~, peakamp~, etc.) so that they are reading the same signal vector when they result?

Thanks,

rjg

TFL's icon

What do you want to do with these values once they're in the message domain?

Or why can't you do all the math and logic in gen?

Maybe one solution is to [mc.pack~] all the signals you want to get to the message domain, and use [mc.snapshot~] to get the value of all of them from the same signal vector, although I'm not sure if [mc.snapshot~] is actually that accurate.