-
Notifications
You must be signed in to change notification settings - Fork 17
/
applyProcess_sim.m
67 lines (55 loc) · 1.51 KB
/
applyProcess_sim.m
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% endfire
% refer to "A Dual-Microphone Speech Enhancement Algorithm
% Based on the Coherence Function"
%
% broadside
% refer to "A coherence-based noise reduction algorithm for binaural
% hearing aids"
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% close all
% clear all;
addpath(genpath('lib'));
addpath(genpath('E:\work\matlab\ehabets\ANF-Generator-master'));
c = 340; % speed of sound
%%
%% load recorded office noise audio
fs = 16000;
angle = [0,0]/180*pi;
% array spacing
d = 0.025;
r = d/2;
switch 1
case 1
slice = [1,3]; % extract speaker-1
disp('speaker-1 is in front of mic1')
case 2
slice = [2,4]; % extract speaker-2
disp('speaker-2 is in front of mic2')
otherwise
disp('other value')
end
[ sig ] = sim.signal_simulation( r,slice );
rmpath(genpath('E:\work\matlab\ehabets\ANF-Generator-master'));
x = sig.x;
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M = size(x,2);
%%
frameLength = 256;
overlap = 128;
inc = frameLength - overlap;
N_FFT = 256;
x1 = x;
%% process
[ y,Fvv2,SNR] = process(x1,d,7);
%% evaluate
speech = sig.speech;
% [pesq_mos]= pesq_vec(speech, out,fs)
rmpath(genpath('lib'));
stoi(sig.clean_i(:,1),x(:,1),fs) %% STOI for noisy speech
stoi(sig.clean_i(1:length(y),1),y,fs) %% STOI for processed speech
visual( x(:,1),y );
% util.fig(out, fs);