# Fluid.ampgate~ CPU usage

**URL:** https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949
**Category:** Bug Reports and Issues
**Created:** [August 12, 2021, 5:53pm UTC](https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949 "2021-08-12T17:53:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![DominicThibault](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/dominicthibault/32/1239_2.png) [@DominicThibault](https://discourse.flucoma.org/u/DominicThibault)
#### Post date: [August 12, 2021, 5:53pm UTC](https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949/1 "2021-08-12T17:53:15Z")

</div>

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 :

- MacOS 10.14.6
- Max 8.1.10
- Attributes for the fluid.ampgate~ object : @minlengthabove 4410 @minlengthbelow 44100 @highpassfreq 80  
 ![Capture d’écran, le 2021-08-12 à 13.43.27](https://discourse.flucoma.org/uploads/default/original/2X/9/98c993ac90caf90349dd3d3dd1155a0aa84afb1a.jpeg)

Thanks for your help!

Dom

---

<div class="post-metadata">

### Author: ![DominicThibault](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/dominicthibault/32/1239_2.png) [@DominicThibault](https://discourse.flucoma.org/u/DominicThibault)
#### Post date: [August 12, 2021, 6:45pm UTC](https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949/2 "2021-08-12T18:45:53Z")

</div>

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.

 ![Capture d’écran, le 2021-08-12 à 14.50.34](https://discourse.flucoma.org/uploads/default/original/2X/4/47e7705a28d555a58324c9c2941e28dbe6388dc9.jpeg)

Clarification here would be appreciated. 🙂

Dom

---

<div class="post-metadata">

### Author: ![weefuzzy](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/weefuzzy/32/362_2.png) [@weefuzzy](https://discourse.flucoma.org/u/weefuzzy)
#### Post date: [August 12, 2021, 11:12pm UTC](https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949/3 "2021-08-12T23:12:09Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![weefuzzy](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/weefuzzy/32/362_2.png) [@weefuzzy](https://discourse.flucoma.org/u/weefuzzy)
#### Post date: [August 12, 2021, 11:18pm UTC](https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949/4 "2021-08-12T23:18:46Z")

</div>

Logged at

> <https://github.com/flucoma/flucoma-core/issues/22>
>
> via https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949
> 
> Reports of CP…U hitting 90-100 % with the \`minlength\` attributes set in the order of 100 - 1000 ms. Will profile...

I’ll try and take a look tomorrow

---

<div class="post-metadata">

### Author: ![DominicThibault](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/dominicthibault/32/1239_2.png) [@DominicThibault](https://discourse.flucoma.org/u/DominicThibault)
#### Post date: [August 18, 2021, 5:48pm UTC](https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949/5 "2021-08-18T17:48:40Z")

</div>

Thanks!

---

<div class="post-metadata">

### Author: ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)
#### Post date: [August 22, 2021, 3:41pm UTC](https://discourse.flucoma.org/t/fluid-ampgate-cpu-usage/949/6 "2021-08-22T15:41:57Z")

</div>

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