<div dir="ltr"><div>Hello!<br><br>I&#39;ve recently started prototyping a synthesizer project using RtAudio and RtMidi. I&#39;m doing the initial development in Windows and I plan to eventually port the project to something like a Raspberry Pi if the prototype goes well.</div><div><br></div><div>I have the audio output and MIDI input working, and I&#39;m starting to think about triggering the synth voices with MIDI notes. I would like to keep the jitter between the notes and the triggered sounds low, but I&#39;m not quite sure how to achieve this with these two APIs.</div><div><br></div><div>A diagram might be helpful here:<br><span style="font-family:monospace">MIDI      -----N----------------------N--------------------------&gt;<br>Input          |                      |<br>               |                      |<br>Audio     |----*-----|----P-----|-----*----|-----P----|----------&gt;<br>Stream       Frame 1    Frame 2    Frame 3    Frame 4    Frame 5</span></div><div><br></div><div>My thinking is that I need to know at what point in the current audio frame an MIDI note arrives. From the diagram, assume a note (N) arrives at the moment corresponding to the 5th sample in Frame 1; knowing this, I can begin playback at the 5th sample on the next frame (P). This way, the latency is held constant at 1 frame and the amount of jitter is minimized.</div><div><br></div><div>So with that long-winded introduction out of the way, my question is:</div><div><br></div><div>Is it possible to recover the timing of MIDI events relative to the audio stream? I can&#39;t see how to do this using the delta time provided with the MIDI note and the stream time provided by RtAudio, but my hope is that I&#39;m missing something.</div><div><br></div><div>Thanks!</div><div><br></div><div>Tim<br></div></div>