[alsa-devel] [Alsa-user] How do I run arecord on raw digital mic buffer?

Clemens Ladisch cladisch at googlemail.com
Wed May 4 10:21:32 CEST 2016


Rob Nertney wrote:
>>> is the best method to build a sound card and a capture PCM?
>>
>> As compared to what?  Any other method will not allow your hardware to
>> be used for audio recording.
>
> As compared to my driver configuring the DMA to capture the data into
> a known buffer, and then directly accessing the buffer to wrap it in
> a WAV format. I should have rephrased my initial question as, "my goal
> is to simply wrap multichannel digital mic input in WAV format; is
> ALSA/arecord the most efficient way to do this?"

If you bypass ALSA, you have to write all the software yourself, and you
will not be able to use your hardware for anything else.

> I should make my buffer at least 2x the size of a period.

Yes.  (You don't need periods if you don't use interrupts to wait for
data being available.)

> I have a buffer ready, under which function does it get passed back to
> the ALSA framework?

Normally, ALSA knows about the buffer, and the driver just reports the
current position.

>   * dma completes/fires period-based IRQ
>   * <<question>> buffer is transferred in function X (?) to Y (?)

When a period is finished, you must call snd_pcm_period_elapsed().

ALSA will then call your .pointer callback to know where in the buffer
the hardware has finished writing.  (Please not that .pointer can also
be called at other times.)


Regards,
Clemens


More information about the Alsa-devel mailing list