fl.cumsum~

I know a few other people have requested a cumulative sum object, (it might have been @swp1g17). Just putting this here so that its recorded. I did try to do something today where I needed it and struggled to reason around it easily with what objects are there.

Don’t know if you ever found a way to do this, but I’ve ended up using fl.biquad~ (somewhat cryptically) for this and frame-wise deltas:


----------begin_max5_patcher----------
547.3ocyVFsaaBCEF9Z3ovxWmhrAaBouJUSSDhSlqB1Lvzkoplm8YeLnltXk
wJr1IRHxmbfi+7O+GyywQ3s5ShNL5dzCnnnmiihfPt.QCiiv0kmpNV1Aogqz
00BkAux+eFwICDemb+9wfxcPH81GuKmNFT0WKUGEF31PeMnt2LFkLDsozT8M
o5vWaEUF+jKkUjPVgn4oteRYvYRBA8E2k7Rbr6zpYxPUecWecHJHKCEzh0.E
94OedTTK55JOHthBZB5hOAngyCRSZPZn2fF9FuXjkvsPQHvnTGNCWj+9X9Yi
veEX76hTk3G148Uft+XhQaS7bHFW+WnX2hwbOUDtiQdwGOhakeuub2YDwdPQ
2QQjP3xVHIMidgMiR4e77pUUhPJJayxnnbvBlkANP5+J9tg4LMAkkfXIHdHy
IqXYTRluQIMGDx+q7lr7kQIYfFRWClxOCqYq3fryHZOaMlCGgvktLJp+A2hO
Om4XmHWOHj6anNQLxRRKM88hKjG9nT86udCTKW72tFzo6aqFuUixF50xsSzY
jpRiTqtLIhOofqyStRjoTo72jjtcmnEVBmWoymRossjr58LgbyTpDcAVNca8
+Gqj6cflOSSQ3baMGR3HyCR1TJ85qVN81hxllmDscCYCEw1D3QMLwJVACkJ+
PvihaEOIGymCQJasVVi0u12BSL7ob+Kgfq0VDU8xgGOs3YKIzfQUZ2WrozSB
zGJ9k3eASf50.A
-----------end_max5_patcher-----------

This is interesting. I don’t understand the maths but it works!

The fl.biquad~ difference eq
y[n] = b[0]x[n] + b[1]x[n-1] + b[2]x[n-2] - a[0]y[n-1] - a[1]y[n-2]

and cumsum
y[n] = x[n] + y[n-1]

=> a[0] = -1, b[0] = 1

and diff
y[n] = x[n] - x[n-1]

=> b[0]=1, b[1]=-1

That makes sense!