博客大神前言: https://blog.csdn.net/ssdzdk/article/details/54890086




WebRTC里面关于 AGC的曲线生成Matlab代码:(用于mode: kAgcModeFixedDigital)



MaxGain = 15;      %  compressionGaindB = analogTarget 
这个参数可以用WebRtcAgc_set_config函数设定, 

% 意义表示在AGC曲线线性区,增益15dBFS

MinGain = -3;     %  targetLevelDbfs 也是在WebRtcAgc_set_config函数设定,
意义表示AGC处理之后最大dBfs幅值,

% 信号大于 -targetLevelDbfs 幅值的信号会被压缩

CompRatio = 3;   %AGC大信号向下压缩的斜率, 大于1表示斜率小于45度

Knee = 1; 
zeros = 0:31; lvl = 2.^(1-zeros);
A = -10*log10(lvl) * (CompRatio - 1) / CompRatio;
B = MaxGain - MinGain;
gains = round(2^16*10.^(0.05 * (MinGain + B * ( log(exp(-Knee*A)+exp(-Knee*B))
- log(1+exp(-Knee*B)) ) / log(1/(1+exp(Knee*B))))));
fprintf(1, '\t%i, %i, %i, %i,\n', gains);
% Matlab code for plotting the gain and input/output level characteristic
(copy/paste the following 3 lines):
in = 10*log10(lvl); out = 20*log10(gains/65536);
subplot(121); plot(in, out); grid on; xlabel('Input (dB)'); ylabel('Gain
(dB)');

subplot(122); plot(in, in+out);  grid on; xlabel('Input (dB)'); ylabel('Output
(dB)');

hold on

subplot(122); plot(in, in,'r-');

zoom on;




运行结果:










阅读这个AGC曲线需要搞清楚InputdB和OutputdB 的坐标和曲线折点,顶点,和等比红线的对比。

还有一个想法,大家可以研究下,有结果可以发我邮箱: [email protected]

就是Webrtc只实现了对大信号的压缩,和中间响度信号的增益,其实在很多地方需要对小信号的一个向下的压缩(比如对-60dBFS以下的信号做压缩)

也就是对信号做也做减益处理,上面CompRatio
这个系数改为0到1之间的数值,然后mingain设置-10左右,maxgain设置为0有一个基本的雏形,但是WebRTC代码不支持这类非法设置。大神有路过实现了对小信号压缩的可以邮件我哈! 
:)






友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:637538335
关注微信