Example_combAudioQual.m 2.1 KB
Newer Older
1
2
3
4
5
% EXAMPLE for the usage of the combined audio quality model that is described
% in Flener et al. (2019). It is a reference-based audio quality model and based on
% monaural (intensity and amplitude modulation) and binaural (interaural level and
% phase differences, interaural vector strength) cues to predict subjective audio
% quality ratings. 
dualberger's avatar
dualberger committed
6
tic
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
cur_dir=pwd;
addpath(genpath(cur_dir)); % include all folders from the current path
%% input signals

if verLessThan('matlab','8.0')
 % reference signal (clean)
[RefSig, fsRef] = wavread('Stimuli/guitar_ref.wav');
% test signal (processed)
[TestSig, fsTest] = wavread('Stimuli/guitar_midAnchor.wav');
else
 % reference signal (clean)
[RefSig, fsRef] = audioread('Stimuli/guitar_ref.wav');
% test signal (processed)
[TestSig, fsTest] = audioread('Stimuli/guitar_midAnchor.wav');
end

% compare sampling frequencies
if fsTest ~= fsRef,
    error('signals have different sampling frequencies')
else
    fs = fsTest;
end

% minlen = min([length(TestSig), length(RefSig)]);
% TestSig = TestSig(1:minlen,1);
% RefSig = RefSig(1:minlen,1);

% calculate objective perceptual measures
stOut = GPSMqBin(RefSig, TestSig, fs); % monaural model output
binQ = BAMQ(RefSig, TestSig, fs); % binaural model output

% **********************************************
% **********Combine outputs of BAMq and GPSMq***
% **********************************************
obj_meas_mon=stOut.out(:,1); % predicted monaural quality rating
obj_meas_bin=binQ(:,1); % predicted binaural quality rating
%*********f3************
mon_tmp=0.0528.*obj_meas_mon;
bin_tmp=0.0078*obj_meas_bin;
obj_meas=min(log10(mon_tmp),bin_tmp);

dualberger's avatar
dualberger committed
48
49
toc

50
51
52
53
disp('***********************')
disp('****monaural measures**')
disp('***********************')
disp(stOut)
dualberger's avatar
dualberger committed
54
55
56
57
58
59
%     SNR_dc: 0.0179
%     SNR_ac: 0.0225
% SNR_dc_fix: 0.0179
% SNR_ac_fix: 0.0225
%        out: 132.6339
%     outFix: 132.7494
60
61
62
63
disp('***********************')
disp('***binaural measures***')
disp('***********************')
disp(binQ)
dualberger's avatar
dualberger committed
64
%     binQ: 100
65
66
67
disp('***********************')
disp('****overall measures***')
disp('***********************')
dualberger's avatar
dualberger committed
68
69
disp(obj_meas)
%     overall measure: 0.7800