# Best practices for audio processing independent of buffer size

**URL:** <https://forum.juce.com/t/best-practices-for-audio-processing-independent-of-buffer-size/42976>\
**Category:** Audio Plugins\
**Created:** [November 28, 2020, 6:10pm UTC](https://forum.juce.com/t/best-practices-for-audio-processing-independent-of-buffer-size/42976 "2020-11-28T18:10:15Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![benvining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/benvining/32/9922_2.png) [@benvining](https://forum.juce.com/u/benvining)\
**Post date:** [November 29, 2020, 7:28pm UTC](https://forum.juce.com/t/best-practices-for-audio-processing-independent-of-buffer-size/42976/3 "2020-11-29T19:28:11Z")

</div>

I’m still a bit new to JUCE, but when I had a [similar problem](http://forum.juce.com/t/basic-questions-process-block-dynamic-resizing-of-things-etc/42875/19), the best solution ended up being to wrap the processBlock into a processBlockPrivate() function that only calls when you have enough samples to feed it.

For your problem, I might try something like this:

where

- desiredNumSamples is an integer variable calculated in prepareToPlay using the samplerate & the desired length of each processing frame (25 ms, it sounds like…)

- storageBuffer is a larger AudioBuffer that will store the incoming audio and be passed to processBlockPrivate() once it contains enough samples. This is some rough code, I would suggest making it a circular buffer by creating some readPosition & writePosition variables, etc…

I think it will be hard to get around doing something like this, for the frame-based processing you’re describing… as far as updating latency, you could keep track of the # of times processBlock() is run before processBlockPrivate() is triggered…

---

_[View the full topic](https://forum.juce.com/t/best-practices-for-audio-processing-independent-of-buffer-size/42976)._
