<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 20, 2014 at 1:07 PM, Len Ovens <span dir="ltr"><<a href="mailto:len@ovenwerks.net" target="_blank">len@ovenwerks.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, 20 Sep 2014, Will Godfrey wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
While getting to grips with Yoshimi I set up a microsecond timer in the function<br>
that actually generates the data. To get a worst-case scenario I did this on my<br>
office machine that's not specially set up for audio.<br>
<br>
I configured jack for 512 frames/period, 2 periods/buffer and 48k, giving an<br>
overall latency of 21.3mS<br>
<br>
Running a moderately complex 12 part tune, the data 'build' time was varying<br>
between about 1.8mS and 6.1mS per buffer. It dropped to less than 1mS when there<br>
was no sound being produced.<br>
</blockquote>
<br></span>
Is it possible to deal with this in two threads? In the case of generating audio, there is no "waiting" for audio to come in to process and the processing could start for the next cycle right after the callback rather than waiting for the next callback(thinking multicore processors). The outgoing audio is put into storage and the callback only puts it into the audio stream. Effectively, the generation thread would be running in sort of a freerun mode, filling up a buffer as there is room to do so.</blockquote><div><br></div><div>this doesn't work for instruments. <br><br>the audio being generated has to change as rapidly as possibly following the receipt of some of event that changes things (e.g. "start playing a new note" or "lower the cutoff frequency of the filter"). fast response/low latency for instruments means that all generation happens as-needed, not pre-rendered, not "in storage". <br><br></div><div>for streaming audio playback (from disk or the net or whatever) this approach is fine and is equivalent of many buffering schemes.<br></div><div> <br></div></div></div></div>