Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
toolbox
Commits
635b0cd4
Commit
635b0cd4
authored
Mar 20, 2017
by
rbo
Browse files
Updated itaHRTF tutorial
parent
8edf6be4
Changes
2
Show whitespace changes
Inline
Side-by-side
applications/Binaural-HRTF/HRTF_class/ita_itaHRTF_examples.m
View file @
635b0cd4
...
@@ -41,7 +41,7 @@ HRTF_find.play_gui(pinkNoise);
...
@@ -41,7 +41,7 @@ HRTF_find.play_gui(pinkNoise);
%% Binaural parameters
%% Binaural parameters
ITD
=
slicePhi
.
ITD
;
% different methods are available: see method in itaHRTF
ITD
=
slicePhi
.
ITD
;
% different methods are available: see method in itaHRTF
ILD
=
slicePhi
.
ILD
;
%
ILD = slicePhi.ILD;
%% Modifications
%% Modifications
% calculate DTF
% calculate DTF
...
@@ -65,8 +65,12 @@ HRTF_interp = HRTF_sphere.interp(coordI);
...
@@ -65,8 +65,12 @@ HRTF_interp = HRTF_sphere.interp(coordI);
nameDaff_file
=
'HRTF_sphere.daff'
;
nameDaff_file
=
'HRTF_sphere.daff'
;
HRTF_sphere
.
writeDAFFFile
(
nameDaff_file
);
HRTF_sphere
.
writeDAFFFile
(
nameDaff_file
);
HRTF_daff
=
itaHRTF
(
'daff'
,
nameDaff_file
);
%
HRTF_daff = itaHRTF('daff',nameDaff_file);
nameDaff_file2
=
'C:\Users\bomhardt\Documents\ITA-Toolbox\applications\TODOunfinished\test_marcia\DATA\HRTF_ITAKopf_Nov2013_MartinPollow\ITA-Kunstkopf_HRIR_Mess01_D180_1x1_256.daff'
;
nameDaff_file2
=
'yourHRTF.daff'
;
HRTF_daff2
=
itaHRTF
(
'daff'
,
nameDaff_file2
);
if
~
strcmp
(
nameDaff_file2
,
'yourHRTF.daff'
)
HRTF_daff2
.
plot_freqSlice
HRTF_daff2
=
itaHRTF
(
'daff'
,
nameDaff_file2
);
\ No newline at end of file
HRTF_daff2
.
plot_freqSlice
else
ita_disp
(
'use an existing daff-file'
)
end
\ No newline at end of file
tutorials/ita_tutorial_itaHRTF.m
0 → 100644
View file @
635b0cd4
% <ITA-Toolbox>
% This file is part of the application HRTF_class for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
%% Init object
coord
=
ita_sph_sampling_equiangular
(
11
,
36
);
coord
.
r
=
0.1
;
pSphere
=
test_rbo_pressureSphere
(
'sph'
,
coord
,
'fftDeg'
,
8
);
HRTF_sphere
=
ita_time_shift
(
itaHRTF
(
pSphere
),
pSphere
.
trackLength
/
2
,
'time'
);
%% Find Functions
coordF
=
itaCoordinates
([
1
pi
/
2
pi
/
2
;
1
pi
/
2
pi
/
4
],
'sph'
);
HRTF_find
=
HRTF_sphere
.
findnearestHRTF
(
coordF
);
% findet das Objekt zu den gegebenen Koordinaten
HRTF_dir
=
HRTF_sphere
.
direction
([
11
15
17
]);
% wie itaAudio.ch(x) nur fr itaHRTF
% Slice of the TF function
slicePhi
=
HRTF_sphere
.
sphericalSlice
(
'theta_deg'
,
90
);
sliceTheta
=
HRTF_sphere
.
sphericalSlice
(
'phi_deg'
,
0
);
%% Plot Functions
% plot frequency domain in dependence of the angle (elevation or azimuth)
sliceTheta
.
plot_freqSlice
pause
(
5
)
close
gcf
slicePhi
.
plot_freqSlice
(
'earSide'
,
'R'
)
pause
(
5
)
close
gcf
% plot ITD
slicePhi
.
plot_ITD
(
'method'
,
'xcorr'
,
'plot_type'
,
'line'
)
% plot time or freq. domain
HRTF_find
.
pt
HRTF_find
.
pf
HRTF_find
.
getEar
(
'R'
)
.
pf
%% Play gui
pinkNoise
=
ita_generate
(
'pinknoise'
,
1
,
44100
,
12
)
*
10
;
HRTF_find
.
play_gui
(
pinkNoise
);
%% Binaural parameters
ITD
=
slicePhi
.
ITD
;
% different methods are available: see method in itaHRTF
%ILD = slicePhi.ILD;
%% Modifications
% calculate DTF
DTF_sphere
=
HRTF_sphere
.
calcDTF
;
HRTFvsDTF
=
ita_merge
(
DTF_sphere
.
findnearestHRTF
(
90
,
90
),
HRTF_sphere
.
findnearestHRTF
(
90
,
90
));
HRTFvsDTF
.
pf
legend
(
'DTF left'
,
'DTF right'
,
'HRTF left'
,
'HRTF right'
)
% interpolate HRTF
phiI
=
deg2rad
(
0
:
5
:
355
);
thetaI
=
deg2rad
(
15
:
15
:
90
);
[
THETA_I
,
PHI_I
]
=
meshgrid
(
thetaI
,
phiI
);
rI
=
ones
(
numel
(
PHI_I
),
1
);
coordI
=
itaCoordinates
([
rI
THETA_I
(:)
PHI_I
(:)],
'sph'
);
% itaCoordinates object
HRTF_interp
=
HRTF_sphere
.
interp
(
coordI
);
%% Write and init
nameDaff_file
=
'HRTF_sphere.daff'
;
HRTF_sphere
.
writeDAFFFile
(
nameDaff_file
);
%HRTF_daff = itaHRTF('daff',nameDaff_file);
nameDaff_file2
=
'yourHRTF.daff'
;
if
~
strcmp
(
nameDaff_file2
,
'yourHRTF.daff'
)
HRTF_daff2
=
itaHRTF
(
'daff'
,
nameDaff_file2
);
HRTF_daff2
.
plot_freqSlice
else
ita_disp
(
'use an existing daff-file'
)
end
\ No newline at end of file
Write
Preview
Markdown
is supported
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