Set buffer size on Android to achieve minimum latency


#1

I read that to get the best possible latency on Android I should use OpenSL, and use the device output native frequency and device native buffer.

But testing the fmod record.cpp example on a Pixel 2 XL (native buffer size = 96) and setting SetDSPBufferSize(96, 4) I get very unstable sound. On a Nokia 7 Plus (native buffer size = 192) it works perfectly setting SetDSPBufferSize(192, 4).

So, I think I’m not correct, and it leads me to some questions:

  • Should the fmod dsp buffer size needs to be equal the device native buffer size?
  • How many buffers should I use? How different is to use a buffer of 1024 from using 2 buffers of 512?
  • Using the record.cpp example, is there any way to achieve the minimum possible latency on each Android device, without getting stuttering/skipping/unstable sound?