# Fluid.bufstats~ - Not enough frames

**URL:** <https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354>\
**Category:** Bug Reports and Issues\
**Created:** [November 15, 2019, 4:30pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354 "2019-11-15T16:30:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [November 15, 2019, 4:30pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/1 "2019-11-15T16:30:52Z")

</div>

I’m cleaning up the final code for my [Cloud HPSS thing](http://discourse.flucoma.org/t/hpss-transients-sliced-realtime-granularization/339), and I’m getting some error messages that I’m not really sure how to interpret.

One is:

> fluid.bufstats~: Not enough frames

Does that mean the buffer it is drawing from doesn’t have enough frames? (I don’t even know what that means) or the buffer it is writing to doesn’t have enough frames (also doesn’t make sense).

I’m not requesting an analysis on a certain amount of frames or anything.

`fluid.bufstats~ @source ---onsets_loudness @stats ---onsets_loudness_stats @numderivs 1 @startchan 0 @numchans 1`

Wouldn’t this return the stats on whatever amount of frames are in the `@source` buffer?

Here is the patch/device if relevant:  
[http://rodrigoconstanzo.com/party/cloudv2.1.zip](http://rodrigoconstanzo.com/party/cloudv2.1.zip)

---

<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:** [November 15, 2019, 4:54pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/2 "2019-11-15T16:54:10Z")

</div>

> [@rodrigo.constanzo](#):
>
> Does that mean the buffer it is drawing from doesn’t have enough frames?

you are using blocking2 right? To be quick, this mode is not resizing so it is on the user to do their maths properly 😉

---

<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:** [November 15, 2019, 4:54pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/3 "2019-11-15T16:54:50Z")

</div>

my trick is to run everything in blocking 1, check the sizes and fix them right (so I don’t have to do the maths)

---

<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:** [November 15, 2019, 5:03pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/4 "2019-11-15T17:03:30Z")

</div>

I’ve opened your pat and it seems that you are not using blocking 2, so sorry for the misleading hint (still valid hypothesis so I won’t edit)

My next step would be to check if the buffers exist. I think they don’t or at least are not valid length because if I doubleclick on the native peak~ I get an empty buffer… like nothing at all. just give them 1 as size and that’ll help. In Max 7 and less buffers with no length were always creating issues in native max objects…

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [November 15, 2019, 5:05pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/5 "2019-11-15T17:05:18Z")

</div>

I’m doing all of that.

The strange part is that it only happens once in a while. So it’s not the buffer, the buffer size, or something obvious like that.

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [November 15, 2019, 5:08pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/6 "2019-11-15T17:08:58Z")

</div>

I was getting some rare (yellow) errors with `irtrimnorm~` which I tracked down, but I still don’t see what that could have to do with this.

---

<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:** [November 15, 2019, 5:18pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/7 "2019-11-15T17:18:28Z")

</div>

> [@rodrigo.constanzo](#):
>
> I’m doing all of that.

no you’re not 😉 Your buffers are instantiated with no duration. That is bad. It used to not work at all, now it almost works for most objects.

I would instantiate like this:  
[buffer~ —onsets\_loudness\_stats @samps 1]  
and then everyone is happy.

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [November 15, 2019, 5:30pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/8 "2019-11-15T17:30:13Z")

</div>

> [@tremblap](#):
>
> no you’re not 😉 Your buffers are instantiated with no duration. That is bad. It used to not work at all, now it almost works for most objects.

What is the deal with this? I _never_ give a size and stuff works. Is it just good practice to give it a size anyway?

---

<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:** [November 15, 2019, 5:33pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/9 "2019-11-15T17:33:07Z")

</div>

> [@jamesbradbury](#):
>
> I _never_ give a size and stuff works.

You’ve just not used Max for long enough 😉 Seriously, it used to not work at all. Now depending on Max versions it works a little, sometimes. So **old people** (like me) use a default value. For instance, in all my perf patches, there is a 1ms size set, then I replace! The other day, @a.harker was surprised you could now instantiate without a duration… so yes :

> [@jamesbradbury](#):
>
> Is it just good practice to give it a size anyway?

yes. you loose nothing and gain in stability. And in backward compatibility. Win win win win!

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [November 15, 2019, 6:14pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/10 "2019-11-15T18:14:31Z")

</div>

I give my HIRT buffers a size of 1, all the FluCoMa ones I don’t say anything since they all get pushed around in size and channels (except when I’m `@blocking`, in which case I declare everything).

Still though, in this case there is still in the buffer, the object is just complaining that there isn’t _enough_ things in the buffer, which I don’t undersatnd.

---

<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:** [November 15, 2019, 7:05pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/11 "2019-11-15T19:05:43Z")

</div>

> [@rodrigo.constanzo](#):
>
> which I don’t undersatnd.

Problem of buffer instantiation are complicated, and API version dependant… I did not investigate too much but the size 0 ones refused to be resized… even with native ‘replace’ message! Hence instantiating with very small value, and voilà! sorted.

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [November 15, 2019, 8:40pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/12 "2019-11-15T20:40:07Z")

</div>

I’ll go ahead and do that.

Either way the error message reporting could be more informative about what it means (destination frames or source frames).

---

<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:** [November 15, 2019, 9:34pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/13 "2019-11-15T21:34:10Z")

</div>

Agreed. In this particular case, it’s not helped that the error message is arising from a secondary condition in the code (which is that the number of frames needs to be \>= the requested number of derivatives), rather than checking for a 0-length source to begin with.

---

<div class="post-metadata">

**Author:** ![pasquetje](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/pasquetje/32/16_2.png) [@pasquetje](https://discourse.flucoma.org/u/pasquetje)\
**Post date:** [February 17, 2021, 2:38pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/14 "2021-02-17T14:38:31Z")

</div>

Hello !

I often get “fluid.bufstats~: Start frame + num frames (X) out of range.”

I wanted to make sure “startframe” and “numframes” are in samples as specified in the reference ? I have the “feeling” it is in ms.  
Sorry if I am wrong.

++ !

---

<div class="post-metadata">

**Author:** ![pasquetje](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/pasquetje/32/16_2.png) [@pasquetje](https://discourse.flucoma.org/u/pasquetje)\
**Post date:** [February 17, 2021, 2:52pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/15 "2021-02-17T14:52:54Z")

</div>

In fact, I realize that the sampling rate of the resulting buffer after a fluid.bufmfcc~ is NOT the one from audio buffers. This is something I completely understand but I did not know (or forgot).  
You should therefore not use “mstosamps~” to get its length.

See here:

```

----------begin_max5_patcher----------
1339.3ocuY0kjiZCD9Y6SgJdLkiKj3+7jSN.4Br0VSIiEdXCH4BI1LS1Zmyd
ZIAr3YvFaLLtpAKjkT2eec2pao4GqW4rW7BS5f9CzWPqV8i0qVY5R2wpl2W4
TReIsfJMCyIUTVx3JmM1eSwdQY5mlppoEHQFRRKOUjyOhpnJV6330k47Blxr
H3lNOQUoOCi7oJVpxpDAgQac2f7sekjnehg1nu9qERTqZWI2ldyOXTBw9u86
dDGce+b8Z8iMyCr.otmU0gNlDkyQpmYn80YYrp1ocphIgUgpxE7m.NfkJp4l
EhLQdfP1F.LPH99IBRzTHBKRuayFNvptXs5F3Zz1jKpssrgsK0qmX1kwwYCx
YOkezo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UndiPcQ
HFv.XIiVWnNG+zzTnp1TQgUq9Bxca7F8CuDBNT2JxMI10GH1d4y0UqXlyS4b
MhYsy0cSuG8mw9i8jAt4Wad3tMnkL2zXqpzkZqglAGM.nDz971bE8ssmAXSE
KWCxmAVehW.IQqCdQj.eSKRje.tQ8mM05r6hXXEa+Q8ESzodq59EfvaJRx4X
E8P9u9+f0fFbmsyTn7lAa0ybzLMR6zhhiAdXyfs93zZmEIwEmX7Q7Z7Qzsft
vuaVPYcVJiXNMSSumpDmDUsgVvTS5FesRzAz1ZCZMC2k220LemGcbaVQaIq2
r2kQW7A2JWhoEvR.JmpmkcSFyIHzJk7D0tyk4fFq+45+G3g9+LA
-----------end_max5_patcher-----------

```

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [February 17, 2021, 3:46pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/16 "2021-02-17T15:46:31Z")

</div>

Some objects use bins though so it’s not always clear.

---

<div class="post-metadata">

**Author:** ![pasquetje](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/pasquetje/32/16_2.png) [@pasquetje](https://discourse.flucoma.org/u/pasquetje)\
**Post date:** [February 17, 2021, 4:58pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/17 "2021-02-17T16:58:52Z")

</div>

Maybe adding some explanation in helpfiles would simply help.

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [February 17, 2021, 5:11pm UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/18 "2021-02-17T17:11:24Z")

</div>

I’ve gotten used to most of them by now (I only notice the diff with novelty really), but it was really confusing at the start.

---

<div class="post-metadata">

**Author:** ![pasquetje](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/pasquetje/32/16_2.png) [@pasquetje](https://discourse.flucoma.org/u/pasquetje)\
**Post date:** [February 18, 2021, 10:02am UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/19 "2021-02-18T10:02:10Z")

</div>

It is the case with “fluid.bufmfcc~” too but a different sampling rate for buffer~ is not a problem at all.

---

<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:** [February 18, 2021, 10:14am UTC](https://discourse.flucoma.org/t/fluid-bufstats-not-enough-frames/354/20 "2021-02-18T10:14:28Z")

</div>

Actually the sampling rate allows you to know the real sampling rate of the values you get in there… isn’t that nice? 😃
