[alsa-devel] ALSA default buffer sizes

Clemens Ladisch clemens at ladisch.de
Wed Aug 26 14:12:19 CEST 2009

Manuel Jander wrote:
> Can anyone tell me why choosing the smallest period size by default is
> a good idea ?

Because there a sound cards where there is no more precise information
about the current position than the period interrupt, so using smaller
periods gives better position information.

Using larger periods is useful only if you really want to save power.

Most PCI drivers have a minimum period size of 32 bytes (related to the
PCI burst size) and do not limit the number of periods, so this
algorithm tends to work just fine.

> Maybe it would be good to know inside the driver that the user program
> does not actually care about the period time?

When the program actually does not care, then it does not matter what
value gets used, so the minimum period time is correct by definition.

> The problem is, as far as I understand right now, I would have to
> increase the minimum period time of the au88x0 driver,

Just increase the maximum number of periods.

Increasing period_bytes_min to 32 or so wouldn't hurt either.

> As a work around, maybe I could set the minimum period bytes to 0,
> and if I encounter that value at snd_pcm_xxx_hw_params(), override
> that value with something useable and reasonable ?

You cannot use values that the ALSA framework does not know about.

> > au88x0_pcm.c has period_bytes_min = 0x1 and periods_max = 32.
> >
> > Is that periods_max an actual hardware limit?
> No. I considered that anything beyond 32 is just plain stupid :)

Those fields are intended to enforce hardware limits.

Besides, using the sound card period interrupt as a 48 kHz timer is a
perfectly valid application.  (Well, as a stress test. :-)

Best regards,

More information about the Alsa-devel mailing list