Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Biberger
CombinedAudioQualityModel
Commits
eec41760
Commit
eec41760
authored
Sep 12, 2019
by
dualberger
Browse files
finalize example file and add adequate stimuli
parent
6b1ed161
Changes
3
Show whitespace changes
Inline
Side-by-side
Example_combAudioQual.asv
0 → 100644
View file @
eec41760
% 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 (ILDs, IPDs), interaural vector strength (IVS)) cues to predict subjective audio
% quality ratings.
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('guitar_K_lin_5_non9985_ASWILD_3_ASWITD200.wav');
else
% reference signal (clean)
[RefSig, fsRef] = audioread('Stimuli/guitar_ref.wav');
% test signal (processed)
[TestSig, fsTest] = audioread('guitar_K_lin_5_non9985_ASWILD_3_ASWITD200.wav');
end
% compare sampling frequencies
if fsTest ~= fsRef,
error('signals have different sampling frequencies')
else
fs = fsTest;
end
%% monaural GPSMq
% The GPSMq is a reference-based audio quality model and based on
% power and envelope power SNRs to predict subjective audio quality ratings.
% A stimuli level of 0 dB full scale rms (dB FS rms, which means 1 in Matlab)
% is assumed to represent a sound pressure level of 100 dB SPL rms.
% Example: stimulus (sound) calibration to 65 dB SPL rms;
% sound_adapt=sound/rms(sound) * 10^((65-100)/20);
% adjust presentation level, e.g. 65 dB SPL rms
RefSig(:,1)=RefSig(:,1)./rms(RefSig(:,1)).*10^((65-100)/20); % Ref. signal, left ch.
RefSig(:,2)=RefSig(:,2)/rms(RefSig(:,2)).*10^((65-100)/20); % Ref. signal, right ch.
TestSig(:,1)=TestSig(:,1)./rms(TestSig(:,1)).*10^((65-100)/20); % Test. signal, left ch.
TestSig(:,2)=TestSig(:,2)/rms(TestSig(:,2)).*10^((65-100)/20); % Test. signal, right ch.
stOut = GPSMqBin(RefSig, TestSig, fs); % monaural model output
%% binaural BAM-Q
% The BAM-Q is a reference-based audio quality model and based on
% binaural cues as interaural level and phase differences (ILDs, IPDs) and interaural
% vector strength (IVS) to predict subjective audio quality ratings.
% Model input:
% - Stereo signals are required as input [left_ch right ch]
% - 0 dB FS should correspond to 115 dB SPL.
% - Clean and distorted signals have to be the same length and temporal aligned.
% - The input signals are required to have a duration of at least 0.4
% seconds.
% Model output, binQ:
% 100 ... no difference
% 0 ... large difference
% -X ... even larger difference
% adjust presentation level, e.g. 65 dB SPL rms
RefSig(:,1)=RefSig(:,1)./rms(RefSig(:,1)).*10^((65-115)/20); % Ref. signal, left ch.
RefSig(:,2)=RefSig(:,2)/rms(RefSig(:,2)).*10^((65-115)/20); % Ref. signal, right ch.
TestSig(:,1)=TestSig(:,1)./rms(TestSig(:,1)).*10^((65-115)/20); % Test. signal, left ch.
TestSig(:,2)=TestSig(:,2)/rms(TestSig(:,2)).*10^((65-115)/20); % Test. signal, right ch.
[binQ, ILDdiff, ITDdiff, IVSdiff] = BAMQpc(RefSig, TestSig, fs);
%% Combine outputs of BAMq and GPSMq
[obj_meas]=combine_binQ_OPM(stOut.out(:,1), binQ(:,1));
disp('***********************')
disp('****monaural measures**')
disp('***********************')
disp(stOut)
% SNR_dc: 3.7852
% SNR_ac: 2.8843
% SNR_dc_fix: 3.7852
% SNR_ac_fix: 2.4026
% out: 41.9663
% outFix: 41.8715
disp('***********************')
disp('***binaural measures***')
disp('***********************')
disp(['binQ: ',num2str(binQ)])
disp(['ILDdiff: ', num2str(ILDdiff)])
disp(['ITDdiff: ', num2str(ITDdiff)])
disp(['IVSdiff: ', num2str(IVSdiff)])
% binQ: 47
% ILDdiff: 5.0702e+03
% ITDdiff: 7.3006e-05
% IVSdiff: 0.0111
disp('***********************')
disp('****overall measures***')
disp('***********************')
disp(['overall_measure: ',num2str(obj_meas)])
% overall measure: 0.7800
\ No newline at end of file
Example_combAudioQual.m
View file @
eec41760
...
...
@@ -12,12 +12,12 @@ 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'
);
[
TestSig
,
fsTest
]
=
wavread
(
'
guitar_K_lin_5_non9985_ASWILD_3_ASWITD200
.wav'
);
else
% reference signal (clean)
[
RefSig
,
fsRef
]
=
audioread
(
'Stimuli/guitar_ref.wav'
);
% test signal (processed)
[
TestSig
,
fsTest
]
=
audioread
(
'
Stimuli/guitar_midAnchor
.wav'
);
[
TestSig
,
fsTest
]
=
audioread
(
'
guitar_K_lin_5_non9985_ASWILD_3_ASWITD200
.wav'
);
end
% compare sampling frequencies
...
...
@@ -29,9 +29,44 @@ end
%% monaural GPSMq
% The GPSMq is a reference-based audio quality model and based on
% power and envelope power SNRs to predict subjective audio quality ratings.
% A stimuli level of 0 dB full scale rms (dB FS rms, which means 1 in Matlab)
% is assumed to represent a sound pressure level of 100 dB SPL rms.
% Example: stimulus (sound) calibration to 65 dB SPL rms;
% sound_adapt=sound/rms(sound) * 10^((65-100)/20);
% adjust presentation level, e.g. 65 dB SPL rms
RefSig
(:,
1
)
=
RefSig
(:,
1
)
.
/
rms
(
RefSig
(:,
1
))
.*
10
^
((
65
-
100
)/
20
);
% Ref. signal, left ch.
RefSig
(:,
2
)
=
RefSig
(:,
2
)/
rms
(
RefSig
(:,
2
))
.*
10
^
((
65
-
100
)/
20
);
% Ref. signal, right ch.
TestSig
(:,
1
)
=
TestSig
(:,
1
)
.
/
rms
(
TestSig
(:,
1
))
.*
10
^
((
65
-
100
)/
20
);
% Test. signal, left ch.
TestSig
(:,
2
)
=
TestSig
(:,
2
)/
rms
(
TestSig
(:,
2
))
.*
10
^
((
65
-
100
)/
20
);
% Test. signal, right ch.
stOut
=
GPSMqBin
(
RefSig
,
TestSig
,
fs
);
% monaural model output
%% binaural BAM-Q
% The BAM-Q is a reference-based audio quality model and based on
% binaural cues as interaural level and phase differences (ILDs, IPDs) and interaural
% vector strength (IVS) to predict subjective audio quality ratings.
% Model input:
% - Stereo signals are required as input [left_ch right ch]
% - 0 dB FS should correspond to 115 dB SPL.
% - Clean and distorted signals have to be the same length and temporal aligned.
% - The input signals are required to have a duration of at least 0.4
% seconds.
% Model output, binQ:
% 100 ... no difference
% 0 ... large difference
% -X ... even larger difference
% adjust presentation level, e.g. 65 dB SPL rms
RefSig
(:,
1
)
=
RefSig
(:,
1
)
.
/
rms
(
RefSig
(:,
1
))
.*
10
^
((
65
-
115
)/
20
);
% Ref. signal, left ch.
RefSig
(:,
2
)
=
RefSig
(:,
2
)/
rms
(
RefSig
(:,
2
))
.*
10
^
((
65
-
115
)/
20
);
% Ref. signal, right ch.
TestSig
(:,
1
)
=
TestSig
(:,
1
)
.
/
rms
(
TestSig
(:,
1
))
.*
10
^
((
65
-
115
)/
20
);
% Test. signal, left ch.
TestSig
(:,
2
)
=
TestSig
(:,
2
)/
rms
(
TestSig
(:,
2
))
.*
10
^
((
65
-
115
)/
20
);
% Test. signal, right ch.
[
binQ
,
ILDdiff
,
ITDdiff
,
IVSdiff
]
=
BAMQpc
(
RefSig
,
TestSig
,
fs
);
%% Combine outputs of BAMq and GPSMq
[
obj_meas
]
=
combine_binQ_OPM
(
stOut
.
out
(:,
1
),
binQ
(:,
1
));
...
...
@@ -40,18 +75,23 @@ disp('***********************')
disp
(
'****monaural measures**'
)
disp
(
'***********************'
)
disp
(
stOut
)
% SNR_dc:
0.0179
% SNR_ac:
0.0225
% SNR_dc_fix:
0.0179
% SNR_ac_fix:
0.0225
% out:
132.6339
% outFix:
132.7494
% SNR_dc:
3.7852
% SNR_ac:
2.8843
% SNR_dc_fix:
3.7852
% SNR_ac_fix:
2.4026
% out:
41.9663
% outFix:
41.8715
disp
(
'***********************'
)
disp
(
'***binaural measures***'
)
disp
(
'***********************'
)
disp
([
'binQ: '
,
num2str
(
binQ
)])
% binQ: 100
disp
([
'ILDdiff: '
,
num2str
(
ILDdiff
)])
disp
([
'ITDdiff: '
,
num2str
(
ITDdiff
)])
disp
([
'IVSdiff: '
,
num2str
(
IVSdiff
)])
% binQ: 47
% ILDdiff: 5.7629e+03
% ITDdiff: 1.5393e-04
% IVSdiff: 0.0248
disp
(
'***********************'
)
disp
(
'****overall measures***'
)
disp
(
'***********************'
)
...
...
Stimuli/guitar_
midAnchor
.wav
→
Stimuli/guitar_
K_lin_5_non9985_ASWILD_3_ASWITD200
.wav
View file @
eec41760
No preview for this file type
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment