Creating deltaclip~ in gen~ (and then improving it)

Tim Lloyd's icon

Has anyone already recreated deltaclip~ in gen~ and is willing to share?

I want a version that handles and can output negative values and should be able to figure out how to modify an existing implementation. I think I get the general idea, but haven't been able to remove small delta values and accumulate to recreate the input ramp without slowly shooting off to infinity. I have the feeling I'm missing something simple.

Here's a start with comments.

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

Thanks in advance :)

Tim Lloyd's icon

Here's a better way. Not quite what I need yet, but it's closer

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

double_UG's icon

there is a gen~ deltaclip in gen~ examples

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

Tim Lloyd's icon

Aha, that's great. Thanks!