Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
4
Merge Requests
4
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
toolbox
Commits
f4ee8472
Commit
f4ee8472
authored
Nov 23, 2017
by
Saskia Wepner
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.rwth-aachen.de:ita/toolbox
parents
d8a5e39b
344e8168
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
3 deletions
+63
-3
applications/Binaural-HRTF/HRTF_class/@itaHRTF/interp.m
applications/Binaural-HRTF/HRTF_class/@itaHRTF/interp.m
+2
-1
applications/Binaural-HRTF/HRTF_class/@itaHRTF/itaHRTF.m
applications/Binaural-HRTF/HRTF_class/@itaHRTF/itaHRTF.m
+4
-2
applications/Binaural-HRTF/HRTF_class/@itaHRTF/reduce_spatial.m
...ations/Binaural-HRTF/HRTF_class/@itaHRTF/reduce_spatial.m
+57
-0
No files found.
applications/Binaural-HRTF/HRTF_class/@itaHRTF/interp.m
View file @
f4ee8472
...
...
@@ -50,7 +50,8 @@ function cThis = interp(this,varargin)
sArgs
=
struct
(
'order'
,
50
,
'eps'
,
1e-5
,
'shiftToEar'
,
false
,
'shiftAxis'
,
'y'
,
'shiftOffset'
,[
-
0.0725
0.0725
]);
sArgs
=
ita_parse_arguments
(
sArgs
,
varargin
,
2
);
if
~
isa
(
varargin
{
1
},
'itaCoordinates'
),
error
(
'itaHRTF:interp'
,
' An itaCoordinate object is needed!'
)
if
isempty
(
varargin
)
||
~
isa
(
varargin
{
1
},
'itaCoordinates'
)
error
(
'itaHRTF:interp'
,
' An itaCoordinate object is needed!'
)
end
field_in
=
varargin
{
1
};
...
...
applications/Binaural-HRTF/HRTF_class/@itaHRTF/itaHRTF.m
View file @
f4ee8472
...
...
@@ -117,6 +117,7 @@ classdef itaHRTF < itaAudio
methods
% Special functions that implement operations that are usually performed only on instances of the class
%% Input
function
this
=
itaHRTF
(
varargin
)
iniAudio
=
[];
% initialize itaHRTF with itaAudio properties (only for nargin == 1)
if
nargin
>
1
||
(
nargin
==
1
&&
(
ischar
(
varargin
{
1
})
||
isa
(
varargin
{
1
},
'itaAudio'
)))
iniAudio
=
[];
...
...
@@ -1017,7 +1018,7 @@ classdef itaHRTF < itaAudio
end
end
% function this = interp(varargin)
this
=
interp
(
varargin
);
%
% Function to calculate HRTFs for arbitrary field points using a N-th order
% spherical harmonics (SH) interpolation / range extrapolation, as described in [1],
...
...
@@ -1055,7 +1056,8 @@ classdef itaHRTF < itaAudio
% Version: 2016-02-05
this
=
reduce_spatial
(
this
,
coords
,
varargin
);
% Function to spatially reduce the HRTF.
function
this
=
smooth_linphase
(
this
,
varargin
)
% function this = smooth_linphase(varargin)
...
...
applications/Binaural-HRTF/HRTF_class/@itaHRTF/reduce_spatial.m
0 → 100644
View file @
f4ee8472
function
[
cThis
]
=
reduce_spatial
(
this
,
newCoordinates
,
varargin
)
%
% This function is used to reduce the spatial sampling from the current
% directions. This is done with a findnearest search. For a reduction to
% interpolated values use interp
%
% INPUT:
%
%
% OUTPUT:
%
%
%
% Author: Jan-Gerrit Richter <jri@akustik.rwth-aachen.de>
% Version: 2017-11-23
oldCoords
=
this
.
getEar
(
'L'
)
.
channelCoordinates
;
% if the desired sampling has more points, its probably unfeasable with
% findnearest search. Abort
if
oldCoords
.
nPoints
<
newCoordinates
.
nPoints
error
(
'There are more points in the wanted sampling than are available. You probably want the interp function'
);
end
% the new coords should have the same radius as the old ones to reduce
% errors
newCoordinates
.
r
=
mean
(
oldCoords
.
r
);
oldCoords
=
oldCoords
.
build_search_database
;
newIndex
=
oldCoords
.
findnearest
(
newCoordinates
);
% calculate all distances from the wanted points to the found points
pointDistances
=
getVectorLength
(
newCoordinates
,
oldCoords
.
n
(
newIndex
));
% calculate the distance between two neighboring points of the new sampling
newSamplingDistance
=
getVectorLength
(
newCoordinates
.
n
(
1
),
newCoordinates
.
n
(
2
));
% the maximum of the found points should always be smaller
if
max
(
pointDistances
)
>
newSamplingDistance
error
(
'The found points are further apart than the sampling allows. Something is wrong'
)
end
cThis
=
this
.
direction
(
newIndex
);
end
function
length
=
getVectorLength
(
pointsA
,
pointsB
)
pointsA
.
r
=
pointsB
.
r
;
vector
=
pointsA
-
pointsB
;
length
=
sqrt
(
vector
.
x
.^
2
+
vector
.
y
.^
2
+
vector
.
z
.^
2
);
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