# Timing issue with midi for large buffsize

**URL:** <https://forum.juce.com/t/timing-issue-with-midi-for-large-buffsize/31726>\
**Category:** General JUCE discussion\
**Created:** [February 12, 2019, 3:28pm UTC](https://forum.juce.com/t/timing-issue-with-midi-for-large-buffsize/31726 "2019-02-12T15:28:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blueteal](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/blueteal/32/5324_2.png) [@Blueteal](https://forum.juce.com/u/Blueteal)\
**Post date:** [February 12, 2019, 3:28pm UTC](https://forum.juce.com/t/timing-issue-with-midi-for-large-buffsize/31726/1 "2019-02-12T15:28:23Z")

</div>

Hello,  
From my understanding, the processBlock method deals with both audio and midi.  
But what if midi needs to be delivered more often than audio ?  
With big buffer size the processBlock is being called with a long delay, which can make the timing of the midi messages innacurate.

(EX :  
Samplerate=44100.0 BufferSize=6912  
156.7ms between each call of processBlock.  
Bpm=200 means that an eighth note is about 150ms)

How to handle it ?

Many thanks

---

<div class="post-metadata">

**Author:** ![Toddler-Boy](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/toddler-boy/32/2007_2.png) [@Toddler-Boy](https://forum.juce.com/u/Toddler-Boy)\
**Post date:** [February 12, 2019, 4:12pm UTC](https://forum.juce.com/t/timing-issue-with-midi-for-large-buffsize/31726/2 "2019-02-12T16:12:35Z")

</div>

Each midi-event has a time-stamp that refers to it’s start offset from the beginning of the audio-buffer. With your example you could realistically get a midi-event that has on offset of 6911 and thus should only be interpreted from that sample onward.

---

<div class="post-metadata">

**Author:** ![Blueteal](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/blueteal/32/5324_2.png) [@Blueteal](https://forum.juce.com/u/Blueteal)\
**Post date:** [February 12, 2019, 4:37pm UTC](https://forum.juce.com/t/timing-issue-with-midi-for-large-buffsize/31726/3 "2019-02-12T16:37:39Z")

</div>

Ok ! So when we are in processBlock, the time stamp of messages in the midibuffer are meaningfull, and plugins should use them at the right place in the current buffer

---

<div class="post-metadata">

**Author:** ![Toddler-Boy](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/toddler-boy/32/2007_2.png) [@Toddler-Boy](https://forum.juce.com/u/Toddler-Boy)\
**Post date:** [February 13, 2019, 7:43pm UTC](https://forum.juce.com/t/timing-issue-with-midi-for-large-buffsize/31726/4 "2019-02-13T19:43:52Z")

</div>

Correct.
