[LAU] Jack - buffers V periods

Tim termtech at rogers.com
Thu Jan 18 00:37:04 UTC 2018



On 01/17/2018 06:58 PM, Will Godfrey wrote:
> I'm getting a little confused when comparing our (Jack) buffer sizes with those
> discussed on Windows, Mac and general music groups.
> 
> These latter never mention periods at all, and it's always frames per buffer,
> so when trying to make comparisons should I take buffers as 1:1 or should I be
> comparing their buffers to our periods?
> 

Hi Will.

 From memory on Windows years ago, and if I understand Jack correctly,
  Jack, or more specifically ALSA (in this case let's say using the
  ALSA driver), puts you much lower-level towards the sound hardware.

You get to specify the period size and the number of periods.

This usually means that you are specifying the size of a hardware
  Direct Memory Access (DMA) buffer and the number of such buffers
  to use. More importantly, that buffer size and the sample rate
  determine the hardware interrupt rate.

If I may make a comparison: Think video games. To avoid 'tearing'
  (motion artifacts) on the screen, we draw graphics on an
  off-screen buffer while another buffer is actually being displayed.
The system continuously about 60 times a second or more 'flips' which
  of these buffers are displayed so now the buffer you just wrote is
  being displayed while the one that was displayed can be safely
  written to without causing tearing. But you must be quick and write
  your inactive buffer before it 'flips' again. More than TWO buffers
  may be used so that several off-screen buffers can be 'queued up'
  for display.

So... The same idea with low(ish)-level RT audio. Jack, ALSA etc.
It will 'flip' among the number of buffers you specify.

List, please correct me if I am wrong here, it has been a while (~2005):
I recall testing Windows, even DirectX (DirectSound), and no
  matter what I did I could /not/ get that hardware interrupt
  rate to change. I tried exclusive mode etc etc.
I seemed that Windows was just providing me with yet another layer.
Hence if I recall, there is only *one* buffer to specify, and
  Windows does the rest. (Regular Multi-Media audio is different.)
Darn, can't remember my DirectX too well, I was heavily into it...
Have things changed? Or have I messed that up that explanation?

Tim.


More information about the Linux-audio-user mailing list