Minimum reasonable latency Was: Re: ZynAddSubFX was: Re: [linux-audio-dev] some new soundfiles on-line
mista.tapas at gmx.net
Thu May 19 14:06:19 UTC 2005
On Thu, 19 May 2005 14:14:06 +0200
Jens M Andreasen <jens.andreasen at chello.se> wrote:
> The Guitarist, processing the output of an instrument in realtime. The
> roundtrip from sample-in to sample-out is what bothers. Getting a
> reliable RT priority saves the day.
> The Synthesist, calculating a sound from midi trigger input in
> realtime. This is almost like "The Guitarist", but with only half of the
> roundtrip buffer worries.
interesting enough, in a 2 periods/buffer setup a synthsist will have to
bear the exact same latency if he wants constant latency. If you give up
constant latency you wil get quicker response.
Here's the rolled out example:
Interrupt N happens at time t_n
The soft synth application prepares the playback buffer for period N+1
(the time after Interrupt N+1 up to the time of Interrupt N+2)
sometimes before interrupt N+1 the keyboarder hits a note (at time t_n +
delta). Now, maybe the soft synth already is done preparing the buffer
for Period N+1, or it might be right in the middle of doing so. Thus,
there's no reliable way to put the corresponding audio event intot the
buffer for period N+1. So, what the soft synth must do is schedule the
event for period N+2.
Interrupt N+1 happens (at time t_n+1)
The softsynth produces output for period N+2. Now it can put the sound
corresponding to t_n + delta at the right position of the buffer which
will be audible during period N+2.
Interrupt N+2 happens (at time t_n+2)
At t_n+2 + delta the sound corresponding to the key hit at time t_n +
delta will be audible.
I don't know of any _reliable_ constant delay (jitter free) way to
schedule events happening during period N for playback during period
N+1. If anyone does, please enlighten me.
Conclusion: In a typical 2 periods per buffer setup a softsynth player
and a guitar player using the computer as efx rack will experience the
exact same delay.
More information about the Linux-audio-dev