[alsa-devel] Read and write different buffer sizes

Elias Kokkinis ekokkinis at upatras.gr
Fri Jan 13 18:42:09 CET 2012


Clemens, thanks for your reply.

Do you think there is a way to accomplish this using different period sizes in input/output? I haven't exactly grasped the way ALSA reads and writes yet, so I have a difficult time planning how to do this...

Elias

On 13 Jan 2012, at 17:01, Clemens Ladisch wrote:

> 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.
> 
> 
> Regards,
> Clemens
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



More information about the Alsa-devel mailing list