>> Hi!
>>  
>> I tried to write some programs for sound processing recently. Most of it
>> went very well, but some questions about the aplay code (version 0.5.10),

please do not use ALSA 0.5.X anymore. it is old and no longer under
development. it has many design issues that are fixed in ALSA 0.9.X.

>> The first is: In the capture_go method a buffer is filled using
>> snd_pcm_plugin_read and than written directly to a wave file. The
>> documentation says that in block mode the driver returns the data for each
>> channel in a separate  part of the buffer. But wave files expect the
>> samples
>> to be interleaved.  As arecord does indeed work, some of my thoughts must
>> be
>> wrong. But which one is it?

these questions have no meaning in ALSA 0.9.X.

>> And the second one: Why is the size of a fragment choosen to be a power of
>> 2? Why not a multiple of os_page_size * number_of_voices? Is it just the
>> programers preference or is there a good reason for it?

because they are the sizes dictated by 99% of all audio hardware. you
cannot force the hardware to generate an interrupt at arbitrary points
in time during its traversal of its ringbuffer, and the vast majority
of audio interfaces can only do so at power-of-two sizes. similar
issues exist for the overall size of the buffer. there are 1 or 2
exceptions to this, but they are really quite strange in their own
ways and i'm not sure they are even manufactured anymore.

--p

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to