function [noise, P, a, Porg] = martin2001(y, nfft, wind, noverlap, U, V, a_max, a_min, actmin_max, intial_noise),
%[NOISE, P, A, PORG] = MARTIN2001(Y, NFFT, WIND, NOVERLAP, U, V, A_MAX,
%A_MIN, ACTMIN_MAX, INTIAL_NOISE) computes the noise estimate, NOISE, in
%the noisy speech signal Y.
%
% Based on an NFFT-point DFT (can be omitted, []), a length-WIND
% Hanning window (scalar, vector forces the function to use custom
% window), and NOVERLAPing samples.
%
% The minimum is sought in a window of D = U*V samples, where D is
% decomposed in to U subwindows of V samples. The smoothing window
% should be choosen 0.7 - 1.0s time-length of window is:
% U*V*(nwind-noverlap)/fs. Martin [1] chooses wind = 256, noverlap =
% 128, U = 8, V = 12, which gives .77s window.
%
% NOISE is the noise estimate from the signal Y. P is the smoothed
% periodigram (nfft long, not compensated for double components due
% to symmetric DFT). The A is the smoothing paramter.
%
% A_MAX and A_MIN are optional bounds on the smoothing parameter for
% the smoothed periodigram. [.96 .3] is default. ACTMIN_MAX is an
% length-nfft column vector, default intialised to 100, which is the
% value entered in each actmin buffer before each
% iteration. INITIAL_NOISE is an estimate of the initial noise.
%
% PORG is an optional output of the actual (un-smoothed) periodigram
% of the signal Y.
%
% References:
% [1] Rainer Martin, "Noise power spectral density estimation based on
% optimal smoothing and minimum statistics", IEEE Trans. on Speech
% and Audio Processing, (9:5), July 2001, pp.504--512
% Author: Thomas Lynge Kjeldsen, Nov. 2006
% Modified: Martin Hammer, 2006-12-11
%
% $Id: martin2001.m 650 2007-05-22 20:37:26Z mhje03 $
msg = nargchk(6,10, nargin);;
error (msg);
nwind = length(wind);
if ( 1 == nwind ),
wind = hanning(wind); % use hanning window of length wind
nwind = length(wind);
end % otherwise wind is the window
if ( isempty(nfft) ) nfft = 2^nextpow2(nwind); end % default DFT size
switch nargin
case 6,
a_max = []; % default max and min smoothing factor
a_min = [];
actmin_max = []; % default estimates
initial_noise = [];
case 7,
a_min = [];
actmin_max = [];
initial_noise = [];
case 8,
actmin_max = [];
initial_noise = [];
case 9,
initial_noise = [];
otherwise,
error('6 first inputs mandatory. Last four optional.');
end
% Initialise function martin2001.m
D = U*V; % window length
MD = mean_min_interpolation(D, 'M'); % interpolate mean of minimum from Table III for (15) and (17)
MD_sub = mean_min_interpolation(V, 'M');
% [y_seg Y_fft] = segmentere_fft(y, nwind, noverlap, nfft); % segmentise signal
[Y_fft] = stft(y, nwind, noverlap, nfft); % segmentise signal
[nfft, nFrame] = size(Y_fft);
P = zeros(nfft, nFrame);
P(:,1) = Y_fft(:,1).*conj(Y_fft(:,1)); % intialise smoothed power spectrum
if (isempty(initial_noise)) initial_noise = .7*P(:,1); end; % default initial noise estimate
noise = [initial_noise zeros(nfft, nFrame-1)]; % initialise noise estimate
P_ = P; % intialisation for (20)
P_2 = P.^2; % intialisation for (21)
subwc = V; % initialise for last subwindow, p. 509
if (isempty(a_max)) a_max = 0.96; end; % max for smoothing factor
if (isempty(a_min)) a_min = 0.3; end; % min for smoothing factor
a_c = [a_max; zeros(nFrame-1,1)]; % initialise correction factor for smoothing (10)
a_v = 2.12; % constant, p. 509
a = zeros(nfft, nFrame); % frequency-dependent smoothing factor (forgetting paramter)
if (isempty(actmin_max)) actmin_max = 100.*ones(nfft, 1); end; % max actmin
actmin = repmat(actmin_max, 1, U);
actmin_sub_max = actmin_max; % max actmin_sub
actmin_sub = actmin_sub_max;
U_c = 1; % subwindow circular buffer index (for actmin)
% Start main loop over time index k
for k = 2:nFrame % for all segments (first is used for initialisation)
% Optimal smoothing parameter, p. 507
a_c_hat = 1/(1+((mean(P(:,k-1))/mean((abs(Y_fft(:,k)).^2)))-1)^2); % (9)
a_c(k) = 0.7*a_c(k-1) + 0.3*max(a_c_hat, 0.7); % (10)
a(:,k) = (a_max.*a_c(k))./(1+(P(:,k-1)./(noise(:,k-1)+eps)-1).^2); % (11)
a(:,k) = max(a(:,k), a_min);
% Optimal smoothing, p. 506
P(:,k) = a(:,k).*P(:,k-1) + (1-a(:,k)).*abs(Y_fft(:,k)).^2; % (4)
% Bias compensation, p. 509
beta = min( a(:,k).^2, 0.8 ); % beta equal a^2, but less than .8, p. 509 below (22)
P_(:,k) = beta.*P_(:,k-1) + (1-beta).*P(:,k); % (20)
P_2(:,k) = beta.*P_2(:,k-1) + (1-beta).*P(:,k).^2; % (21)
Q = max(2*noise(:,k-1).^2./(P_2(:,k)-P_(:,k).^2), 2); % (23)
Q_ = (Q-2*MD)/(1-MD); % (16)
Bmin = 1 + (D-1)*2./Q_; % (17)
Q_sub = (Q-2*MD_sub)/(1-MD_sub); % (16)sub
Bmin_sub = 1 + (V-1)*2./Q_sub; % (17)sub
Q_1 = mean(Q.^(-1)); % p. 509 (mid of page)
Bc = 1 + a_v*sqrt(Q_1);
k_mod = zeros(nwind,1);
% Seek minimum for the smoothed noise power
expr = ( P(:,k).*Bmin.*Bc < actmin(:,U_c) ); % if P(:,k).*Bmin.*Bc < actmin(:,U_c)
actmin(:, U_c) = expr.*(P(:,k).*Bmin.*Bc) + (1-expr).*actmin(:,U_c); % then actmin(:, U_c) = P(:,k).*Bmin.*Bc
actmin_sub = expr.*(P(:,k).*Bmin_sub.*Bc) + (1-expr).*actmin_sub; % then actmin_sub = P(:,k).*Bmin_sub.*Bc
k_mod = expr; % and-then k_mod = 1
if (V == subwc),
lmin_flag = ones(nfft, 1) - k_mod; % if (k_mod == 1) then lmin_flag = 0
Pmin_u = min(actmin')'; % seek minimum in each column and make column vector
if (Q_1 < 0.03) noise_slope_max = 8; % determine noise_slope_max level
elseif (Q_1 < 0.05) noise_slope_max = 4;
elseif (Q_1 < 0.06) noise_slope_max = 2;
else noise_slope_max = 1.2;
end
expr = lmin_flag & ((actmin_sub < noise_slope_max*Pmin_u) & (actmin_sub > Pmin_u)); % if expr true,
Pmin_u = expr.*actmin_sub + (1-expr).*Pmin_u; % then P_min_u(k) equals actmin_sub(k)
actmin = repmat(expr.*actmin_sub, 1, U) + (ones(nfft, U) - repmat(expr, 1, U)).*actmin; % and-then replace all previously stored values of actmin(k) by acntmin_sub(k)
lmin_flag = zeros(nfft, 1); % re-initialise lmin_flag
subwc = 1; % reset subwindow counter
U_c = mod(U_c, U) + 1; % increment index length-8 circular buffer
actmin_sub = actmin_sub_max; % prepare actmin vectors for new input, set to maximum
actmin(:,U_c) = actmin_max;
noise(:,k) = noise(:,k-1); % update noise estimate
else % end if (V == subwc)
if subwc > 1
lmin_flag = k_mod; % if (k_mod == 1) then lmin_flag = 1
noise(:,k) = min(actmin_sub, Pmin_u); % recompute the noise estimate
Pmin_u = noise(:,k); % reset the length-D buffer
else
noise(:,k) = noise(:,k-1); % update noise estimate
end
subwc = subwc + 1; % increment subwc
end % end else ~(V == subwc)
end
if (nargout > 3)
Porg = Y_fft.*conj(Y_fft);
if (nargout > 4)
noise_seg = abs(mean(noise));
sig_seg = abs(mean(Porg) - noise_seg);
SNR_seg = sig_seg./noise_seg;
end
end
return;
function val = mean_min_interpolation(len, type),
% Interpolate from Table III, either TYPE = 'M' for M(D), or TYPE = 'H',
% for H(D). LEN is the window length.
%
% Author: Martin Hammer, 2006-12-11
% Modified:
[type, msg] = get_method(type, {'m', 'h'});
error(msg);
D = [1 2 5 8 10 15 20 30 40 60 80 120 140 160]'; % From Table III on p. 512 [1]
M = [0 .26 .48 .58 .61 .668 .705 .762 .8 .841 .865 .89 .9 .91]';
H = [0 .15 .48 .78 .98 1.55 2.0 2.3 2.52 2.9 3.25 4.0 4.1 4.1]';
index = min(find( (D- len) > 0)); % find index closest to len, but larger (
没有合适的资源?快使用搜索试试~ 我知道了~
基于MATLAB实现的speech enhancement的经典噪声估计源代码完整,可直接使用+使用说明文档.rar
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共2个文件
md:1个
m:1个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 150 浏览量
2024-05-22
17:17:42
上传
评论
收藏 7KB RAR 举报
温馨提示
CSDN IT狂飙上传的代码均可运行,功能ok的情况下才上传的,直接替换数据即可使用,小白也能轻松上手 【资源说明】 基于MATLAB实现的speech enhancement的经典噪声估计源代码完整,可直接使用+使用说明文档.rar 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2020b;若运行有误,根据提示GPT修改;若不会,私信博主(问题描述要详细); 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可后台私信博主; 4.1 期刊或参考文献复现 4.2 Matlab程序定制 4.3 科研合作 功率谱估计: 故障诊断分析: 雷达通信:雷达LFM、MIMO、成像、定位、干扰、检测、信号分析、脉冲压缩 滤波估计:SOC估计 目标定位:WSN定位、滤波跟踪、目标定位 生物电信号:肌电信号EMG、脑电信号EEG、心电信号ECG 通信系统:DOA估计、编码译码、变分模态分解、管道泄漏、滤波器、数字信号处理+传输+分析+去噪、数字信号调制、误码率、信号估计、DTMF、信号检测识别融合、LEACH协议、信号检测、水声通信 5、欢迎下载,沟通交流,互相学习,共同进步!
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 2 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
IT狂飙
- 粉丝: 4779
- 资源: 2658
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)