# Best practice for resizing buffers in prepareToPlay

**URL:** <https://forum.juce.com/t/best-practice-for-resizing-buffers-in-preparetoplay/10714>\
**Category:** Audio Plugins\
**Created:** [July 1, 2013, 9:07pm UTC](https://forum.juce.com/t/best-practice-for-resizing-buffers-in-preparetoplay/10714 "2013-07-01T21:07:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lalala](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lalala/32/8577_2.png) [@lalala](https://forum.juce.com/u/lalala)\
**Post date:** [July 1, 2013, 9:07pm UTC](https://forum.juce.com/t/best-practice-for-resizing-buffers-in-preparetoplay/10714/1 "2013-07-01T21:07:20Z")

</div>

In prepareToPlay(), as the doc says that estimatedSamplesPerBlock is just a hint and isn’t any kind of guarantee,  
I always set the size of my buffer as twice the estimatedSamplesPerBlock :

```auto

```

For now I never had more samples than 2 \* estimatedSamplesPerBlock in the processBlock, but I guess the behaviour may change depending on the audio drivers and hosts (?)

Is that good practice ? is it always enough or should I double-check everything is fine in processblock?  
How are you dealing with this ?

thanks for your opinion!

---

<div class="post-metadata">

**Author:** ![lalala](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lalala/32/8577_2.png) [@lalala](https://forum.juce.com/u/lalala)\
**Post date:** [July 4, 2013, 2:49pm UTC](https://forum.juce.com/t/best-practice-for-resizing-buffers-in-preparetoplay/10714/2 "2013-07-04T14:49:05Z")

</div>

no one really ?

---

<div class="post-metadata">

**Author:** ![andrewj](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/andrewj/32/13428_2.png) [@andrewj](https://forum.juce.com/u/andrewj)\
**Post date:** [July 4, 2013, 6:46pm UTC](https://forum.juce.com/t/best-practice-for-resizing-buffers-in-preparetoplay/10714/3 "2013-07-04T18:46:22Z")

</div>

I can’t definitively say that you won’t get away with doubling the buffer, but its not safe. I always check inside processBlock - it’s not nice to resize your buffers in there, but it’s better than crashing.

I’ve never tested it, but I think I remember reading somewhere that FruityLoops can send a wide variety of buffer sizes, so that’d be a host to be careful of.
