Fluid.ampgate~ CPU usage

Hello everyone!

I’ve recently started using the flucoma objects in my Max patches. I want to build a simple recording device that will start recording when the loudness of the incoming sound is above a certain threshold and stop when it’s below another threshold . I was gonna use fluid.ampgate~ but came across extreme CPU load. Loading a single object generates an average of 90% CPU usage with peaks above 100%.

I dont’ know if I’m doing anything wrong in the instantiation of the object or if it relates to my system. Here’s the info that I can gather :

Thanks for your help!

Dom

After a bit of investigation : the @minlengthabove and @minlengthbelow attributes are extremely heavy on the CPU.

I’m not quite sure how different @rampup and @rampdown are to the attributes mentioned above. They seem to behave similarly but cost barely anything in terms of CPU usage.

Clarification here would be appreciated. :slight_smile:

Dom

Hi @DominicThibault,

Thanks for the report. The minlength<X> attributes do add CPU load, but spikes of that order sound worrying. The difference between these and the ramp<X> attributes is that the latter simply do, effectively, what slide~ does and apply (very cheap) exponential smoothing to the detection signal. The minlength<X> attributes, OTOH, are doing full lookback / ahead. I’ll make an issue on GitHub and run your settings with a profiler to see what’s up.

Logged at

I’ll try and take a look tomorrow

Thanks!

Definitely an old known bug but nobody but me flagged it before :wink: There is a fix in the PR if you fancy an adventure in compiling-land.