问题描述
我正在测试 WebRTC AGC,但我一定是做错了什么,因为信号只是未经修改地通过.
I am testing the WebRTC AGC but I must be doing something wrong because the signal just passes through unmodified.
以下是我创建和初始化 AGC 的方法:
Here's how I create and initialize the AGC:
agcConfig.compressionGaindB = 9;
agcConfig.limiterEnable = 1;
agcConfig.targetLevelDbfs = 9; /* 9dB below full scale */
WebRtcAgc_Create(&agc);
WebRtcAgc_Init(agc, minLevel, maxLevel, kAgcModeFixedDigital, 8000);
WebRtcAgc_set_config(agc, agcConfig);
然后对于每个 10ms 的样本块,我执行以下操作:
And then for each 10ms sample block I do the following:
WebRtcAgc_Process(agc, micData, NULL, 80, micData, NULL, micLevelIn, &micLevelOut, 0, &saturationWarning);
其中 micLevelIn
设置为 0.
谁能告诉我我做错了什么?
Can somebody tell me what I'm doing wrong?
我预计全量程正弦音会衰减到目标 DBFS 级别;低电平正弦音(即 -30dBFS)将被放大以匹配目标 DBFS 电平.但这不是我所看到的.
I expected that a full scale sine tone would be attenuated to the target DBFS level; and a low level sine tone (i.e. -30dBFS) would be amplified to match the target DBFS level. But that's not what I'm seeing.
推荐答案
以下是用于 Webrtc_AGC 的操作顺序:
Here is the sequence of operations to be used for Webrtc_AGC:
- 创建AGC:
WebRtcAgc_Create
- 初始化AGC:
WebRtcAgc_Init
- 设置配置:
WebRtcAgc_set_config
- 初始化
capture_level = 0
- 对于
kAgcModeAdaptiveDigital
,调用VirtualMic:WebRtcAgc_VirtualMic
- 使用
capture_level
处理缓冲区:WebRtcAgc_Process
- 获取从
WebRtcAgc_Process
返回的输出捕获级别并将其设置为capture_level
- 对
音频缓冲区
重复 5 到 7 - 摧毁 AGC:
WebRtcAgc_Free
- Create AGC:
WebRtcAgc_Create
- Initialize AGC:
WebRtcAgc_Init
- Set Config:
WebRtcAgc_set_config
- Initialize
capture_level = 0
- For
kAgcModeAdaptiveDigital
, invoke VirtualMic:WebRtcAgc_VirtualMic
- Process Buffer with
capture_level
:WebRtcAgc_Process
- Get the out capture level returned from
WebRtcAgc_Process
and set it tocapture_level
- Repeat 5 to 7 for the
audio buffers
- Destroy the AGC:
WebRtcAgc_Free
检查 webrtc/modules/audio_processing/gain_control_impl.cc 以供参考.
Check webrtc/modules/audio_processing/gain_control_impl.cc for reference.
这篇关于WebRTC AGC(自动增益控制)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!