基于matlab振幅波形文件特性的动态参数

基于matlab振幅波形文件特性的动态参数,matlab,audio,dynamic,parameters,noise,Matlab,Audio,Dynamic,Parameters,Noise,我已经实现了噪声门,使语音wav文件中的噪声(不包括语音)变为静音,但有五个参数(由主程序发送),我必须自己填充这些参数。我有一个问题,我的程序如何在每次输入不同噪声特征的语音wav文件时给出建议参数? 我在想:我可以使用语音wav文件振幅的平均值来获得建议参数吗 function n = noisegate( x, Fs, AT, RT, holdtime, ltrhold, utrhold) % ------- Parameter Input --------- % x - Input fi

我已经实现了噪声门,使语音wav文件中的噪声(不包括语音)变为静音,但有五个参数(由主程序发送),我必须自己填充这些参数。我有一个问题,我的程序如何在每次输入不同噪声特征的语音wav文件时给出建议参数? 我在想:我可以使用语音wav文件振幅的平均值来获得建议参数吗

function n = noisegate( x, Fs, AT, RT, holdtime, ltrhold, utrhold)
% ------- Parameter Input ---------
% x - Input file
% Fs - sample frequency
% AT - Attack time 
% RT - Release time 
% ltrhold - lower threshold
% utrhold - upper threshold

att = round(AT*Fs); %calculate attack time in samples
rel = round(RT*Fs); %calculate release time in samples
ht = round(holdtime*Fs); %calculate hold time in samples
g = zeros(size(x)); %allocate an array for gain
%initialize low and high threshold counters
ltcnt = 0;
utcnt = 0;
%Calculate RMS Peak
%time average for peak measurement
tav = 0.2;
TAV =1 - exp(-2.2/(Fs*tav));
xrms(1) = 0;
for n = 2 : length(x)
 xrms(n) = (1-TAV)*xrms(n-1) + TAV*x(n)^2;
 if (xrms(n) <= ltrhold || (xrms(n) < utrhold && ltcnt > 0))
 ltcnt = ltcnt + 1;
 utcnt = 0;
 if (ltcnt > ht), %hold time of low threshold exceeded
 if(ltcnt > (ht + rel)) %hold and release time exceeded
 %set gain to zero to completely fade out the sound
 g(n) = 0;
 else
 %fade out the sound here
 g(n) = 1 - (ltcnt - ht)/rel;
 end
 elseif (ltcnt < ht & (ltcnt == n))
 g(n) = 0;
 else
 g(n) = 1;
 end
 elseif (xrms(n) > utrhold || (xrms(n) > ltrhold && utcnt > 0))
 ltcnt = 0;
 utcnt = utcnt + 1;
 if(utcnt > ht)
 %maximum attack and hold time exceeded
 if(utcnt > (ht + att))
 %set gain to 1
 g(n) = 1;
 else
 %applay gain smoothening
 g(n) = (utcnt - ht)/att;
 end
 else
 g(n) = 0;
 end
 end
end
n = x.*g;

end
函数n=noisegate(x,Fs,AT,RT,holdtime,ltrhold,utrhold) %----参数输入--------- %x输入文件 %Fs-采样频率 %攻击时 %释放时间 %低阈值 %保持-上限阈值 att=圆形(AT*Fs);%计算样本中的攻击时间 rel=圆形(RT*Fs);%计算样品中的释放时间 ht=四舍五入(保持时间*Fs);%计算样本中的保持时间 g=零(尺寸(x));%分配阵列以获得增益 %初始化低阈值和高阈值计数器 ltcnt=0; utcnt=0; %计算均方根峰值 %峰值测量的时间平均值 tav=0.2; TAV=1-exp(-2.2/(Fs*TAV)); xrms(1)=0; 对于n=2:长度(x) xrms(n)=(1-TAV)*xrms(n-1)+TAV*x(n)^2; if(xrms(n)0)) ltcnt=ltcnt+1; utcnt=0; 如果(ltcnt>ht),则超过低阈值的%保持时间 如果超过(ltcnt>(ht+rel))%保持和释放时间 %将增益设置为零以完全淡出声音 g(n)=0; 其他的 %在这里把声音淡出 g(n)=1-(ltcnt-ht)/rel; 终止 elseif(ltcntutrhold | |(xrms(n)>ltrhold&utcnt>0)) ltcnt=0; utcnt=utcnt+1; 如果(utcnt>ht) %超过最大攻击和保持时间 如果(utcnt>(ht+att)) %将增益设置为1 g(n)=1; 其他的 %applay增益平滑 g(n)=(utcnt-ht)/att; 终止 其他的 g(n)=0; 终止 终止 终止 n=x*g; 终止
wav文件的平均功率将为您提供信号加噪声的功率。要设置阈值,您需要知道一段仅包含噪声的wav文件。这样,您可以在两者之间设置阈值。或者计算信号加噪声的平均功率,假设噪声总是,比如说,至少比动态范围和峰值因子值低20dB,我能描述噪声和语音与这些值的关系吗?先生,请您详细解释一下好吗?对不起,我不知道您的意思。动态范围值将显示响度和柔和度之间的范围,即平均范围峰值振幅和噪声地板,峰值系数将显示峰值振幅和均方根值之间的范围。你知道吗,先生?是的,我知道这些参数是什么,但我不知道它们和你原来的问题有什么关系