Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institute of Technical Acoustics (ITA)
toolbox
Commits
15e3d22d
Commit
15e3d22d
authored
7 years ago
by
Michael Kohnen
Browse files
Options
Downloads
Patches
Plain Diff
Fixeds in channelseparation and new features
parent
9677b867
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
applications/SpatialAudio/ita_ctc_channelSeparation.m
+40
-20
40 additions, 20 deletions
applications/SpatialAudio/ita_ctc_channelSeparation.m
applications/SpatialAudio/ita_ctc_channelSeparation_naturalOptimum.m
+21
-0
21 additions, 0 deletions
...s/SpatialAudio/ita_ctc_channelSeparation_naturalOptimum.m
with
61 additions
and
20 deletions
applications/SpatialAudio/ita_ctc_channelSeparation.m
+
40
−
20
View file @
15e3d22d
function
[
CS_L
CS_R
]
=
ita_ctc_channelSeparation
(
HRTF_real
,
CTCFilter
,
varargin
)
function
[
CS_L
CS_R
CS_L_singleSpectrum
CS_R_singleSpectrum
]
=
ita_ctc_channelSeparation
(
HRTF_real
,
CTCFilter
,
varargin
)
%ITA_CTC_CHANNELSEPARATION Returns and plots channelseparation for ctc
%systems
% HRTF_real represent the real HRTFs that will occure in the CTC system,
...
...
@@ -15,6 +15,8 @@ function [ CS_L CS_R ] = ita_ctc_channelSeparation(HRTF_real, CTCFilter, varargi
% [LS3_left_CTCFilter LS3_right_CTCFilter]
% ...
%
% TODO: Frequency ranges
opts
.
naturalCS
=
true
;
opts
.
doubleSpectrum
=
true
;
opts
.
singleSpectrum
=
true
;
...
...
@@ -23,13 +25,14 @@ opts.plot = true;
opts
=
ita_parse_arguments
(
opts
,
varargin
);
hrtf
=
ita_merge
(
HRTF_real
(:));
hrtf
.
signalType
=
'energy'
;
L
=
itaAudio
;
L
.
signalType
=
'energy'
;
helper
=
ita_convolve
(
hrtf
.
ch
(
1
),
CTCFilter
(
1
));
numSamples
=
helper
.
nSamples
;
%% Left channel input
L
.
time
=
zeros
(
numSamples
,
hrtf
.
nChannels
/
2
);
L
.
time
=
zeros
(
numSamples
,
1
);
R
=
L
;
for
k
=
1
:
size
(
CTCFilter
,
1
)
L
=
L
+
ita_convolve
(
hrtf
.
ch
(
2
*
k
-
1
),
CTCFilter
(
k
,
1
));
...
...
@@ -38,7 +41,7 @@ end
CS_L
=
ita_merge
(
L
,
R
);
%% Right channel input
L
.
time
=
zeros
(
numSamples
,
hrtf
.
nChannels
/
2
);
L
.
time
=
zeros
(
numSamples
,
1
);
R
=
L
;
for
k
=
1
:
size
(
CTCFilter
,
1
)
L
=
L
+
ita_convolve
(
hrtf
.
ch
(
2
*
k
-
1
),
CTCFilter
(
k
,
2
));
...
...
@@ -47,29 +50,46 @@ end
CS_R
=
ita_merge
(
L
,
R
);
%% Bruno Diss p 83 (5-11)
if
opts
.
singleSpectrum
CS_L_singleSpectrum
=
ita_divide_spk
(
CS_L
.
ch
(
1
),
CS_L
.
ch
(
2
));
CS_R_singleSpectrum
=
ita_divide_spk
(
CS_R
.
ch
(
2
),
CS_R
.
ch
(
1
));
CS_L_value
end
%% Natural channel separation
if
opts
.
naturalCS
for
k
=
1
:
2
:
hrtf
.
nChannels
if
hrtf
.
ch
(
k
)
.
rms
>
hrtf
.
ch
(
k
+
1
)
.
rms
naturalCS
(
ceil
(
k
/
2
))
=
ita_divide_spk
(
hrtf
.
ch
(
k
),
hrtf
.
ch
(
k
+
1
));
else
naturalCS
(
ceil
(
k
/
2
))
=
ita_divide_spk
(
hrtf
.
ch
(
k
+
1
),
hrtf
.
ch
(
k
));
end
end
[
natCS_L
natCS_R
]
=
ita_ctc_channelSeparation_naturalOptimum
(
hrtf
);
end
%% Plot
if
opts
.
plot
if
opts
.
singleSpectrum
CS_L
.
pf
;
CS_R
.
pf
;
end
if
opts
.
doubleSpectrum
CS_L_singleSpectrum
.
pf
;
CS_R_singleSpectrum
.
pf
;
CS_L
.
pf
;
legend
({
'Left in, left ear'
'Left in, right ear'
});
title
(
'Channel separation - left ear'
);
set
(
gcf
,
'name'
,
'Channel separation - left ear'
);
CS_R
.
pf
;
legend
({
'Right in, left ear'
'Right in, right ear'
});
title
(
'Channel separation - right ear'
);
set
(
gcf
,
'name'
,
'Channel separation - right ear'
);
end
if
opts
.
singleSpectrum
&&
opts
.
naturalCS
merged_CS_L
=
ita_merge
(
natCS_L
,
CS_L_singleSpectrum
);
merged_CS_R
=
ita_merge
(
natCS_R
,
CS_R_singleSpectrum
);
merged_CS_L
.
pf
;
legend
({
'Optimal natural CS for left in'
'CTC CS for left in'
});
title
(
'Channel separation - left ear (natural vs CTC)'
);
set
(
gcf
,
'name'
,
'Channel separation - left ear'
);
merged_CS_R
.
pf
;
legend
({
'Optimal natural CS for right in'
'CTC CS for right in'
});
title
(
'Channel separation - right ear (natural vs CTC)'
);
set
(
gcf
,
'name'
,
'Channel separation - right ear'
);
elseif
opts
.
singleSpectrum
merged_CS
=
ita_merge
(
CS_L_singleSpectrum
,
CS_R_singleSpectrum
);
merged_CS
.
pf
;
legend
({
'CS for left in'
'CS for right in'
});
title
(
'Channel separation'
);
set
(
gcf
,
'name'
,
'Channel separation'
);
elseif
opts
.
naturalCS
merged_CS
=
ita_merge
(
natCS_L
,
natCS_R
);
merged_CS
.
pf
;
legend
({
'Optimal natural CS for left in'
'Optimal natural CS for right in'
});
title
(
'Channel separation'
);
set
(
gcf
,
'name'
,
'Channel separation'
);
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
applications/SpatialAudio/ita_ctc_channelSeparation_naturalOptimum.m
0 → 100644
+
21
−
0
View file @
15e3d22d
function
[
natCS_L
natCS_R
]
=
ita_ctc_channelSeparation_naturalOptimum
(
ls_HRTF
)
%ITA_CTC_CHANNELSEPARATION_NATURALOPTIMUM Summary of this function goes here
% Detailed explanation goes here
hrtf
=
ita_merge
(
ls_HRTF
(:));
hrtf
.
signalType
=
'energy'
;
for
idxLS
=
1
:(
hrtf
.
nChannels
/
2
)
L
(
idxLS
)
=
ita_divide_spk
(
hrtf
.
ch
(
idxLS
*
2
-
1
),
hrtf
.
ch
(
idxLS
*
2
));
R
(
idxLS
)
=
ita_divide_spk
(
hrtf
.
ch
(
idxLS
*
2
),
hrtf
.
ch
(
idxLS
*
2
-
1
));
end
L
=
ita_merge
(
L
(:));
R
=
ita_merge
(
R
(:));
natCS_L
=
L
.
ch
(
1
);
natCS_R
=
R
.
ch
(
1
);
for
idxF
=
1
:
numel
(
L
.
ch
(
1
)
.
freqData
)
natCS_L
.
freqData
(
idxF
)
=
max
(
abs
(
L
.
freqData
(
idxF
,:)));
natCS_R
.
freqData
(
idxF
)
=
max
(
abs
(
R
.
freqData
(
idxF
,:)));
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment