-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain_TOT_AWPE.m
More file actions
167 lines (136 loc) · 5.9 KB
/
Copy pathmain_TOT_AWPE.m
File metadata and controls
167 lines (136 loc) · 5.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
% This is to run the recursive (forgetting factor) based adaptive
% weighted prediction error (AWPE) algorithm for dereverberation
% (speech enhancement).
%
%
% Authors: Yujie Zhu
% Date: 08/08/2023
%-------------------------------------------------------------------------
clear;clc;
close all;
% all path in the current folder are included.
warning('OFF')
addpath(genpath(pwd))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % 1) often change parameters %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
use_16k_signal = 1;
overall_performance = 1;
segment_performance = 1;
% % choose to use direct path signal or early reflections as reference signal
ref_as_early_refelection= 1; % 1: early reflection; 0) direct path
% length of the start seconds for initalization
% Para_AWPE.init_time = 5.0; % with italization
Para_AWPE.init_time = 0.001; % without italization
% Parameters for dereverberation (DR)
M = 8;
Kl = 16;
alpha_rls = 0.995; % forgetting factor for RLS adaptive
Para_AWPE.Kl = Kl;
Para_AWPE.alpha_rls = alpha_rls;
% minimum value of the variance on the denominator
Para_AWPE.lamuda_min = 1e-3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % 1) load the noisy signal %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%load('cleansignal_0_01_16k.mat');
load('cleansignal_16k.mat');
%load('cleansignal_0_135_16k_change.mat');
%load('Measured_Signal_t610_snr20_0_30_16k_change.mat');
%load('Measured_Signal_t610_0_30_16k_change.mat');
%time_range = [0*Fs+1:40.1*Fs];
time_range = [0*Fs+1:25*Fs];
Para_AWPE.cut_kind = 2;
if ref_as_early_refelection
x = Xearly(time_range,1); % only consider the first channel
else
x = Sclean(time_range,1);
end
y = Xclean(time_range,1:M);
y = 0.5*y./max(max(y));
M = length(y(1,:));
% clear some data and parameters
clear Xclean Sclean Xearly time_range
Para_AWPE.Fs = Fs;
% % choose to use direct path signal or early reflections as reference signal
if ref_as_early_refelection
delta_N = 10; % the delay in frame
PM_data.x_max = 40;
PM_data.CD_min = 0; PM_data.CD_max = 5;
PM_data.LLR_min = 0; PM_data.LLR_max = 0.8;
PM_data.SNR_min = 0; PM_data.SNR_max = 25;
PM_data.PESQ_min = 0; PM_data.PESQ_max = 4.5;
else
delta_N = 2; % the delay in frame
PM_data.x_max = 40;
PM_data.CD_min = 0; PM_data.CD_max = 5;
PM_data.LLR_min = 0; PM_data.LLR_max = 0.8;
PM_data.SNR_min = 0; PM_data.SNR_max = 25;
PM_data.PESQ_min = 0; PM_data.PESQ_max = 4.5;
end
Para_AWPE.delta_N = delta_N;
P_vect = [1,2,3,4];
Para_AWPE.ct = 0.5;
% % call the AWPE dereverbeation filter
PM_data.CD_matrix = [];
PM_data.LLR_matrix = [];
PM_data.SNR_matrix = [];
PM_data.PESQ_matrix = [];
DE_method = 'AWPE';
[Sig_der, delay] = derev_awpe_RLS(y,Para_AWPE);
delay = delay+1;
Sig_der = Sig_der(delay : end-delay);
% length
Sig_clean = x(1:length(Sig_der),1);
Sig_observed = y(1:length(Sig_der),1);
%clear x y DE_method Doa_Info
% % Implement Performance evaluation
Para_AWPE.overall_performance = overall_performance;
Para_AWPE.segment_performance = segment_performance;
PER = performance_evaluation(Para_AWPE, Sig_clean, Sig_observed, Sig_der);
time_vect = PER.time_vect;
PM_data.CD_origin = PER.CD_origin(:);
PM_data.LLR_origin = PER.LLR_origin(:);
PM_data.SNR_origin = PER.SNR_origin(:);
PM_data.PESQ_origin = PER.PESQ_origin(:);
PM_data.CD_matrix(:,1) = PER.CD_enhanced(:);
PM_data.LLR_matrix(:,1) = PER.LLR_enhanced(:);
PM_data.SNR_matrix(:,1) = PER.SNR_enhanced(:);
PM_data.PESQ_matrix(:,1) = PER.PESQ_enhanced(:);
for p_index = 1:length(P_vect)
Para_AWPE.P = P_vect(p_index);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % 2) Implement AWPE Dereverberation %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DE_method = 'AWPE-TOT';
Para_AWPE.L11 = 8;
Para_AWPE.L12 = 8;
Para_AWPE.L2 = 2;
[Sig_der, delay] = derev_awpe_RLS_TOT(y, Para_AWPE);
delay = delay+1;
Sig_der = Sig_der(delay : end-delay);
% length
Sig_clean = x(1:length(Sig_der),1);
Sig_observed = y(1:length(Sig_der),1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % 2) Dereverberation Performance Evaluation %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Implement Performance evaluation
Para_AWPE.overall_performance = overall_performance;
Para_AWPE.segment_performance = segment_performance;
PER = performance_evaluation(Para_AWPE, Sig_clean, Sig_observed, Sig_der);
time_vect = PER.time_vect;
%PM_data.CD_origin = PER.CD_origin(:);
%PM_data.LLR_origin = PER.LLR_origin(:);
%PM_data.SNR_origin = PER.SNR_origin(:);
%PM_data.PESQ_origin = PER.PESQ_origin(:);
PM_data.CD_matrix(:,p_index+1) = PER.CD_enhanced(:);
PM_data.LLR_matrix(:,p_index+1) = PER.LLR_enhanced(:);
PM_data.SNR_matrix(:,p_index+1) = PER.SNR_enhanced(:);
PM_data.PESQ_matrix(:,p_index+1) = PER.PESQ_enhanced(:);
end
% save data_KAWPE_P_2Mic PM_data time_vect
% save data_AWPE_switch_simu PM_data time_vect Sig_clean Sig_observed Sig_der
Fun_plot_figure_method_TOT(time_vect(:,2),PM_data)
save('PM_data.mat', 'PM_data','time_vect');
Fun_plot_spectrum_AWPE(Sig_clean, Sig_observed, Sig_der, Fs);