-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvaluate.m
31 lines (23 loc) · 820 Bytes
/
Evaluate.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
function [SDR, SIR, SAR] = Evaluate(OriginalSourceFile, SeparatedSourceFile, varargin)
addpath ..\..\Codes\Matlab\BSS_EvalToolbox;
s = audioread(OriginalSourceFile);
x = audioread(SeparatedSourceFile);
s = s(:)'; % Making sure s is a row vector
x = x(:)'; % Making sure x is a row vector
if nargin > 2, % We should ignore some parts at the beginning and at the ending of the signals
s(1:varargin{1}) = [];
x(1:varargin{1}) = [];
s(end:-1:end - varargin{1} +1) = [];
x(end:-1:end - varargin{1} +1) = [];
end
%% Putting the length of the signals the same
if length(x) > length(s),
x = x(1:length(s));
else
s = s(1:length(x));
end
%% Evaluating
%S = [organ'; piccolo'];
[s_target, e_interf, e_artif] = bss_decomp_gain(x, 1, s);
[SDR, SIR, SAR] = bss_crit(s_target, e_interf, e_artif);
end