-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathpesq3.m
47 lines (39 loc) · 1.44 KB
/
pesq3.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
function [ res ] = pesq3( reference_sig, degraded_sig, Fs, fileNum )
% A wrapper for the objective Perceptual Evaluation of Speech Quality measure
%
% Syntax: [ res ] = pesq3( reference_sig, degraded_sig, Fs, fileNum )
%
% Inputs:
% reference_sig - Reference (clean, talker, sender) speech signal
% degraded_sig - Degraded (noisy, listener, receiver) speech signal
% Fs - Sampling Frequency
% fileNum - An ID number to append to the temporary audio files. Useful
% when several instances are to be run together (in parallel).
%
% Outputs:
% res - Raw PESQ result for narrowband and MOS-LQO result for wideband
%
% See also: pesq2mos.m
% Author: Jacob Donley
% University of Wollongong
% Email: [email protected]
% Copyright: Jacob Donley 2017
% Date: 03 October 2015
% Revision: 0.1
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if nargin < 4
fileNum = 0;
end
temp_path = [pwd filesep '+Miscellaneous\+Temporary\'];
ref_path = [ 'tmp_ref' num2str(fileNum) '.wav'];
deg_path = [ 'tmp_deg' num2str(fileNum) '.wav'];
if ~exist(temp_path,'dir'); mkdir(temp_path); end
max_val = max(abs([reference_sig(:); degraded_sig(:)]));
audiowrite([temp_path ref_path], reference_sig / max_val, Fs);
audiowrite([temp_path deg_path], degraded_sig / max_val, Fs);
res = pesq2_mtlb(ref_path, ...
deg_path, ...
Fs, 'wb', [pwd filesep '+Tools\pesq_NoResFile.exe'], ...
temp_path);
end