ALSA: relationship between speaker period size and microphone

I have an audio conferencing device that has a microphone and speaker. Both the microphone and the speaker with the same sampling frequency specified by snd_pcm_hw_params_set_rate_near() say that it is 8000 Hz. Is it necessary to set the period size and the number of periods the same for both (for two such devices exchange data with each other)?

Or can I choose a different period / period size for the speaker than the one configured for the microphone? How can I determine which period and period to use?

I use the snd_pcm_hw_params_set_period_size_near() and snd_pcm_hw_params_set_periods_near() APIs to set the size and period of the period for both the speakers and the microphone.

(I am new to ALSA).

+4
source share
1 answer

The size of the period and size of the buffer depends on the driver, but if it is the same device, it is likely that the playback and capture devices support the same parameters.

Regardless of whether the settings should be the same, it depends on how your application accesses these devices. As for the driver, these devices work independently.

What buffer / period sizes are used depends on how you want to balance latency, power consumption and overload security. Latency is directly proportional to the size of the buffer on playback devices or the period on capture devices. Energy consumption increases slightly for shorter periods. Xrun's security is enhanced by larger buffers and slightly by shorter periods.

+4
source

All Articles