* Read and write different buffer sizes
@ 2012-01-13 12:19 Elias Kokkinis
2012-01-13 15:01 ` Clemens Ladisch
0 siblings, 1 reply; 3+ messages in thread
From: Elias Kokkinis @ 2012-01-13 12:19 UTC (permalink / raw)
To: alsa-devel
Hello all,
I would like to ask if it is possible in ALSA to define different buffer sizes in the input and output streams.
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.
I don't know if I am making myself clear here, maybe it's the 10 hours of work up to now, but anyway any help/comments would be greatly appreciated.
Elias Kokkinis
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Read and write different buffer sizes
2012-01-13 12:19 Read and write different buffer sizes Elias Kokkinis
@ 2012-01-13 15:01 ` Clemens Ladisch
2012-01-13 17:42 ` Elias Kokkinis
0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2012-01-13 15:01 UTC (permalink / raw)
To: Elias Kokkinis; +Cc: alsa-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Read and write different buffer sizes
2012-01-13 15:01 ` Clemens Ladisch
@ 2012-01-13 17:42 ` Elias Kokkinis
0 siblings, 0 replies; 3+ messages in thread
From: Elias Kokkinis @ 2012-01-13 17:42 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: alsa-devel
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@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-13 17:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-13 12:19 Read and write different buffer sizes Elias Kokkinis
2012-01-13 15:01 ` Clemens Ladisch
2012-01-13 17:42 ` Elias Kokkinis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.