Search code examples
audioraspberry-pimp3alsa

Does ALSA buffer size have a hardware-defined upper limit?


I have a Raspberry Pi with an i2s MEMS mic attached. I'm recording audio from it, using the SOX library, and trying to increase my ALSA buffer_size.

My ALSA buffer_size is currently 65536, but I want to increase this. Is there any theoretical limit to the buffer size? How large can it be?

Thanks!


Solution

  • The theoretical limit is 2^32 frames. But the practical limit is whatever your hardware actually supports.

    To read the current maximum buffer size, call snd_pcm_hw_params_get_buffer_size_max() ("current" because it might be constrained by other hardware parameters, such as the sample rate or number of channels).