Simple integrator

Mattebass's icon

Hi,
I'm just trying to make a simple patch that sum the first 512 samples in a signal
that arrives in the gen object, and having back the result only for these 512, stopping the sum
when reached the sample index of 511.
I've tried to use +=~ but I can't figure out how to stop the sum after the desired number of values are summed. Any advice?
Thanks

Matteo

Max Gardener's icon

The latch operator might be useful.

Mattebass's icon

Thanks, I've tried this, but without success.

Max Patch
Copy patch and select New From Clipboard in Max.

kLSDiz's icon

Maybe something like this:

Max Patch
Copy patch and select New From Clipboard in Max.

Accumulate until counter is below 512 threshold.

Also "first x samples" in implies that you want to point the moment in time to start counting samples, hence reset button.