ALSA:扬声器和麦克风的周期大小之间的关系 [英] ALSA: Relation between period size of speaker and mic

查看:38
本文介绍了ALSA:扬声器和麦克风的周期大小之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有麦克风和扬声器的音频会议设备.麦克风和扬声器都具有由 snd_pcm_hw_params_set_rate_near() 设置的相同采样率,比如 8000 Hz.我是否需要将两者的周期大小和周期数设置为相同(两个此类设备相互通信)?

I have audio conferencing device which has a mic and speaker. Both mic and speaker having same sampling rate set by snd_pcm_hw_params_set_rate_near() say 8000 Hz. Do I need to set period size and number of periods to be same for both (for two such devices communicate each other) ?

或者我可以为扬声器选择与麦克风配置不同的周期/周期大小吗?我如何决定使用哪个周期和周期大小?

Or can I choose a different period/period size for speaker than the one configured for mic ? How do I decide on which period and period size to use ?

我正在使用 snd_pcm_hw_params_set_period_size_near()snd_pcm_hw_params_set_periods_near() API 来设置扬声器和麦克风的周期大小和周期.

I am using snd_pcm_hw_params_set_period_size_near() and snd_pcm_hw_params_set_periods_near() APIs to set period size and period for both speaker and mic.

(我是 ALSA 的新手).

(I am new to ALSA).

推荐答案

支持的周期大小和缓冲区大小取决于驱动程序,但如果是同一设备,则播放和捕获设备可能支持相同的参数.

What period sized and buffer sizes are supported depends on the driver, but if it's the same device, it's likely that the playback and capture devices support the same parameters.

参数是否需要相同取决于您的应用程序如何访问这些设备.就驱动程序而言,这些设备独立工作.

Whether the parameters need to be the same depends on how your application accesses these devices. As far as the driver is concerned, these devices work independently.

要使用的缓冲区/周期大小取决于您希望如何平衡延迟、功耗和过载/欠载安全.延迟与播放设备上的缓冲区大小或捕获设备上的周期大小成正比.用电量在较短的时间内略有增加.Xrun 安全性通过更大的缓冲区增加,并通过更短的周期增加一点.

What buffer/period sizes to use depends on how you want to balance latency, power usage, and over/underrun safety. Latency is directly proportional with the buffer size on playback devices or the period siz on capture devices. Power usage is increased slightly by shorter periods. Xrun safety is increased by larger buffers, and a little by shorter periods.

这篇关于ALSA:扬声器和麦克风的周期大小之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆