Fluid.transients~ spike-y/glitchy CPU use?

Before posting this as a git issue, wanted to check here to see if I’m missing something.

It seems like fluid.transients~ likes to make pops all over the audio when it’s loaded up. As in, if I’m using something like this in a patch, the audio starts crackling like crazy, even with the (average) CPU usage very low.

Here’s a simple patch showing what I mean:

<pre><code>
----------begin_max5_patcher----------
2033.3oc6ZssjiZyD9ZOOETjbo2ojDmL+WM+OGaskKYiLiRvHJP3Y1jJ6ydz
IvhSdvri8NIYmK7HTKg59qOntE5OeXk6N1qjJWm+mymcVs5OeX0JUWxNVYdd
k6Q7q6yvUpg4tq.y2+Lozcsl3IJ4kSzJ5NZFk+U4PfFJrCGpHb869S9OBV67
IuGANewPNis+2IIIk3zp8krrL4.AFZ6yn6+c9ykr5zms6mji2kQdd3DzDNMj
fdUpn+Awt2coGYIc6gUlHDJqdxwGUivMgbjUwpySdT.DBouQxY07LBm+0BhV
Fcqno4Xwp2HgzD07Y69sOEzLIbYpAtce5.Mi3tVLumYfPOviX5A4iOkwXEhF
PY6SrLQyynVd8QZtXYqrYUkJglmtsjr2.3QdR.OHR9KBFK+2l3G67dz7u5EA
kc9WO7f7m0yzPHm7hPxZjKN4U0J6dHqll7HuDmWQI47pu47zNoRPpBbBfHmm
THsS.v4o8Y0GKxH4o7mcf.QGEXkpxIz24oWn4IrWTO5CdKLescqQ0.Pj6XPH
bZHDhBTXHRgdBVWgknIAQu+C.hvEBh9a.+DDa.QvRAQOzOAQCHFuPLzK1+mX
nAC2rTLL3FZGtr7KTQW.+CJ6hqI4A+vFvfbbGIwFCrRmn09RpuKIUzjZ62WG
cL5sRb.AUYN.88eLP7j2zYNX+lzh3pVM6JWYJNmHkUTVt0nE7cQgU2qrlhzb
32XpWzl0scQy0cE11UIQZUnmueau3Rg7vEBScoN4sWC8cO+ZDpkx7ZZaJOJC
SCKoLAkI8UUf2qmrzRsg7YDxS4DrYi723XENEEEcFgjF.ZCCKEtPiWPxo4EB
MiPGg48QjDxAbcFe6AlHBgwfBJ0EiP+fgAG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2LzyelLtDkg2Hdv6J3gaENflKPHS+YV
d.v.UVG1Ocq38qD.eaiOjtTwPcURcdBFoNUGO0.g5uL5sQpPuaZj.efJJD.Z
oQTOcq3c3UFO8lvEv32snRnnPKDrIp9MDAkeXh2Id2yReee384taPiYxsgKB
lIWDeKYh4FVcj3uiaBB02cklvpvn94n2bWbf+fEHz0IPlXTWPf.+XEnQhlLt
.oScw5gwEGuevhylqS+38lFbnai.8tsKXne70rK345LTWnjIJznsTGQoSgV2
npyWaowkS798hxT2yxz27KYw2ajEeuwKFACksh.wa.9BDuGduK0ZV5P5s+Hb
g5LVYoWpQuklKuQZj9E5CLS0FAVaoqJk2nyA2mFI1JjLpsW4X55NfSuuwzkg
mN.iOxK.EKYVuHTfupEJxO.duX8AGP6kY9coGnYYshvXk8iySM2YrnyW7IMk
ZNKsDmPMeXqND6.KnX.LVYp3YLUjsDcAGXzXlIr0TKT7Wz5QaM9TQMSMZyFg
5X8nsFL0hRVAqrwSUvdw1TaJ92sUdsp7+1YEOzS85sH5e8KtBqYE+5KLiAHU
KgpS.KuWVxl2gNN1Ud4jI+QBd+2bG4N86trqYqthI+flem3V1B92+kQ26ZuL
5ZDDFAu96htZHcObLMh1eqWCtNXK2N6jNw1sV0sMPyM20wObFKTm8+6kc6se
kgCWYv20J6MiEtg69tWH3bVHXmERa7z6BrKWidWb8dWZ8gWX8our58un5pfc
ScA0e3ud3uoevPAE
-----------end_max5_patcher-----------
</code></pre>

(I pasted a few more instances just to exacerbate the issue)

And here’s a video showing what I mean (filmed with my phone in case the audio driver doesn’t capture the glitches):

It sounds like what happens when you have audio in interrupt on and have a metro banging like crazy somewhere, but that’s not the case here, it’s just overdrive on.

Is this normal/expected behavior?

Here’s a more real-world use case to show the weirdness.

With moderate cpu usage (~30% average) the audio becomes unusable. AND the CPU spiking is so much that it even impacts non-Max audio?!

Unfortunately, that’s built in to the algorithm that transients uses and, despite trying quite hard, I didn’t find I way to calm it down appreciably

The algo is, lamentably, much more expensive in direct proportion to the number of transients it finds because each time it finds one it is synthesising audio at profligate* expense. The higher the order and blocksize, the more awful that will be. So, if nothing else, the average CPU reports from Max won’t be giving the full impression of how hard the processor is getting smacked.

* At the very least, quadratic w.r.t. order, IIRC. Or maybe even blocksize, which would be even worse.

1 Like

Hmm, good (and bad) to know.

I’ll play with it a bit more to see if I can get something that sounds alright without turning everything else into popcorn.

Also bananas how far reaching the CPU usage is, as this is a pretty fast computer (m2 pro)…

Fingers crossed. Getting the order and blocksize down as much as you can is the key!

1 Like

Ok dialed those down and it’s less…popcorn. What I’ll do is wrap it up in a poly~ as in SP-Tools I’ve bundled fluid.transients~ and fluid.hpss~ together as different modes of the same object. And I’ll make fluid.hpss~ the default so you don’t accidentally get popcorn unless you really want it.