[alsa-devel] Read and write different buffer sizes

Clemens Ladisch clemens at ladisch.de
Fri Jan 13 16:01:28 CET 2012

Elias Kokkinis wrote:
> I would like to ask if it is possible in ALSA to define different
> buffer sizes in the input and output streams.

Yes.  (But which buffer sizes are allowed always depends on the
hardware's capabilities.)

> I am using PCM sound and I want to read 2048 samples, do some
> processing involving overlap-add and then keep 1024 of them and put
> them to the output. And so on...
> So I want to have the same sample rate and everything but different
> buffer sizes. Is this possible? I have tried an implementation of
> this, but I think the output for some reason still outputs 2048
> samples and the audio is choppy, like having 1024 samples of audio and
> 1024 of silence.

Regardless of the buffer size, when both devices run at the same rate,
you must output, on the average, as many samples as you have read.


More information about the Alsa-devel mailing list