Commit b7835ac6 authored by Jan-Gerrit Richter's avatar Jan-Gerrit Richter
Browse files

Merge branch 'master' of https://git.rwth-aachen.de/ita/toolbox

parents ef21eaa1 a750c6b4
......@@ -684,11 +684,7 @@ classdef itaHRTF < itaAudio
end
%HRTFout = this.direction(idxCoord);
end
function this = buildsearchdatabase(this)
this.dirCoord = this.dirCoord.build_search_database;
end
end
function obj = direction(this, idxCoord)
%return the HRTF (L&R) for a/multiple given direction indices
......@@ -752,7 +748,7 @@ classdef itaHRTF < itaAudio
earCoords = this.getEar('L').channelCoordinates;
switch dirID
case {'phi_deg', 'p'}
phiValues = uniquetol(earCoords.phi_deg);
phiValues = uniquetol(earCoords.phi_deg,0.0001);
[~,index] = min(abs(phiValues - dir_deg));
exactPhiValue = phiValues(index);
tmp = earCoords.n(earCoords.phi_deg == exactPhiValue);
......@@ -760,13 +756,15 @@ classdef itaHRTF < itaAudio
slice = this.findnearestHRTF(thetaU,dir_deg);
case {'theta_deg', 't'}
thetaValues = uniquetol(earCoords.theta_deg);
thetaValues = uniquetol(earCoords.theta_deg,0.0001);
[~,index] = min(abs(thetaValues - dir_deg));
exactThetaValue = thetaValues(index);
tmp = earCoords.n(earCoords.theta_deg == exactThetaValue);
phiU = tmp.phi_deg;
slice = this.findnearestHRTF(dir_deg,phiU);
slice = this.direction(find(earCoords.theta_deg == exactThetaValue));
% tmp = earCoords.n(earCoords.theta_deg == exactThetaValue);
% phiU = tmp.phi_deg;
%
% slice = this.findnearestHRTF(dir_deg,phiU);
end
end
......@@ -1283,7 +1281,7 @@ classdef itaHRTF < itaAudio
% init
sArgs = struct('pos1_data','itaHRTF', 'method', 'phase_delay', 'filter' , [200 2000] ,...
'thresh','10dB','energy',true,'centroid',false,'reshape',true,...
'theta_deg',[],'plot_type','color');
'theta_deg',[],'plot_type','color','axes_handle',[]);
[this,sArgs] = ita_parse_arguments(sArgs,varargin);
% calculate ITD
......@@ -1313,8 +1311,13 @@ classdef itaHRTF < itaAudio
%..............................................................
% create figure
position = get(0,'ScreenSize');
figure
set(gcf,'Position',[10 50 position(3:4)*0.85]);
if isempty(sArgs.axes_handle)
figure
set(gcf,'Position',[10 50 position(3:4)*0.85]);
else
axes(sArgs.axes_handle);
hold on;
end
if strcmp(sArgs.method,'phase_delay') && ischar(sArgs.filter) % frequency dependent ITD
pcolor(phiC_deg,this.freqVector,ITD)
title(strcat('\phi = ', num2str(round(thetaC_deg)), '�'))
......
......@@ -325,7 +325,7 @@ classdef itaOptitrack < handle
delete(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10\NatNetSDK\Samples\Matlab\quaternion.m'))
delete(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10\NatNetSDK\Samples\Matlab\quaternion-license.txt'))
fprintf( '[itaOptitrack] NatNet SDK has been successfully downloaded.\n' );
fprintf( '[itaOptitrack] NatNet SDK 2.10 has been successfully downloaded.\n' );
end
......
......@@ -259,16 +259,20 @@ classdef itaOrientation
% set view vector, nPoints x 3, mtx(vx vy vz) [double]
assert( isequal(size(value),size(this.view)),['Size of input must be ',num2str(this.nPoints),' x 3, mtx(vx vy vz) [double].'])
%NOTE PSC:
%-normalization of up and view already done in ita_vu2quat()
%-specify the dimension to row vectors when using cross()
% calculate side vector and new up vector
if isequal(value,this.up) % case new view vector is old up vector
s = cross(this.view,this.up);
u = normr(cross(s,this.up));
s = cross(this.view,this.up, 2);
u = cross(s,this.up, 2);
elseif isequal(value,-this.up) % case new view vector is negative old up vector
s = cross(this.view,-this.up);
u = normr(cross(s,this.up));
s = cross(this.view,-this.up,2);
u = cross(s,this.up, 2);
else
s = cross(value,this.up);
u = normr(cross(s,value));
s = cross(value,this.up, 2);
u = cross(s,value, 2);
end
this.mOrient = ita_vu2quat(value,u);
end
......@@ -277,16 +281,20 @@ classdef itaOrientation
% set up vector, nPoints x 3, mtx(ux uy uz) [double]
assert( isequal(size(value),size(this.up)),['Size of input must be ',num2str(this.nPoints),' x 3, mtx(ux uy uz) [double].'])
%NOTE PSC:
%-normalization of up and view already done in ita_vu2quat()
%-specify the dimension to row vectors when using cross()
% calculate side vector and new view vector
if isequal(value,this.view) % case new up vector is old view vector
s = cross(this.view,this.up);
v = normr(cross(this.view,s));
s = cross(this.view,this.up, 2);
v = cross(this.view,s, 2);
elseif isequal(value,-this.view) % case new up vector is negative old view vector
s = cross(this.view,-this.up);
v = normr(cross(this.view,s));
s = cross(this.view,-this.up, 2);
v = cross(this.view,s, 2);
else
s = cross(this.view,value);
v = normr(cross(value,s));
s = cross(this.view,value, 2);
v = cross(value,s, 2);
end
this.mOrient = ita_vu2quat(v,value);
end
......@@ -399,4 +407,13 @@ classdef itaOrientation
end
%% Create functions
methods(Static = true)
function obj = FromViewUp(view, up)
assert( size(view, 2) == 3 && size(up, 2) == 3,'Size of both inputs must be N x 3 [double].' )
assert( isequal(size(view),size(up)),'Number of view and up vectors must be the same.' )
obj = itaOrientation(ita_vu2quat(view, up));
end
end
end
......@@ -63,7 +63,7 @@ else
end
% calculate side vector
s = cross(v, u);
s = cross(v, u, 2); %NOTE PSC: Matlab thinks in column vectors, so this would fail in case of two 3x3 matrices when not transposing v and u.
% build rotation matrix
vec_ent = size(v,1);
......
function [polar_DEG] = ita_elevation2polarDEG(ele_DEG)
%ELEVATION2POLAR Converts elevation angle to polar angle
% Elevation angle, where frontal direction is 0°, to polar angle, where
% above direction is 0°
polar_DEG=90-ele_DEG;
end
function [ele_DEG] = ita_polar2elevationDEG(polar_DEG)
%ELEVATION2POLAR Converts elevation angle to polar angle
% To Elevation angle, where frontal direction is 0°, from polar angle, where
% above direction is 0°
ele_DEG=90-polar_DEG;
end
......@@ -272,7 +272,7 @@ classdef load_ac3d
line( obj.nodes([polyNodes; polyNodes(1)],component2axesMapping(1)) * invertAxes(1), ...
obj.nodes([polyNodes; polyNodes(1)],component2axesMapping(2)) * invertAxes(2), ...
obj.nodes([polyNodes; polyNodes(1)],component2axesMapping(3)) * invertAxes(3), ...
'Color', [.1 .1 .1]);
'Color', [.6 .6 .6]);
end
else
% display GA model
......@@ -405,10 +405,14 @@ classdef load_ac3d
[A, S] = obj.getEquivalentAbsorptionArea_sabine();
end
function RT = getReverbTime(obj, material_path, sabine_or_eyring, airAbsorption, portal_surface_materials)
if nargin < 3
function RT = getReverbTime(obj, material_path, sabine_or_eyring, factor, airAbsorption, portal_surface_materials)
if nargin < 4
airAbsorption = zeros(1,31);
end
if nargin < 3
factor = 0.161;
end
if nargin < 3
sabine_or_eyring = 'eyring';
end
......@@ -416,7 +420,7 @@ classdef load_ac3d
material_path = '..\RavenDatabase\MaterialDatabase';
end
if nargin > 4
if nargin > 5
if strcmp(sabine_or_eyring, 'eyring')
[A, S] = obj.getEquivalentAbsorptionArea_eyring(material_path, portal_surface_materials);
else
......@@ -438,7 +442,7 @@ classdef load_ac3d
%RT = 0.163 .* obj.totalVolume ./ A;
% RT = (2.76 / sqrt(273.15 + room_temperature)) .* (obj.totalVolume ./ A);
RT = 0.163 .* obj.totalVolume ./ (A + 4*airAbsorption*obj.totalVolume);
RT = 0.161 .* obj.totalVolume ./ (A + 4*airAbsorption*obj.totalVolume);
end
% get surface area of given material
......
......@@ -439,7 +439,7 @@ else
% Create an empty helper dataset, which contains all directions
% (angular pairs). Then we can just iterate over all records,
% making iteration over directions a lot less complicated
props.dataset = daff_create_dataset('channels', props.channels, ...
props.dataset = daffv15_create_dataset('channels', props.channels, ...
'alpharange', props.alpharange, ...
'alphapoints', props.alphapoints, ...
'betarange', props.betarange, ...
......@@ -542,7 +542,9 @@ if strcmpi(props.content, 'MS')
% Frequencies must be provided
if ~isfield(props.dataset, 'freqs')
error('When writing magnitude spectrum content, you must specify ''freqs''');
warning('When writing magnitude spectrum content, you should specify ''freqs''');
warning('Frequency vector set to ANSI center frequencies (20 Hz - 20 kHz)');
props.dataset.freqs = ita_ANSI_center_frequencies;
end
props.numfreqs = length(props.dataset.freqs);
......
......@@ -18,7 +18,7 @@ function [ freqs, mags, metadata ] = dfBulbMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'magnitude spectrum of bulb shape for higher frequencies';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfDiscMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'magnitude spectrum in cube shape weighted by frequency (for fun!)';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfDipoleMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Dipole magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfDiscMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'magnitude spectrum in disc shape weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,8 @@ function [ freqs, mags, metadata ] = dfFrontalDiracMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Dirac in frontal direction magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,8 @@ function [ freqs, mags, metadata ] = dfFrontalHemisphereMS( alpha, beta, basepat
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Dirac in frontal direction magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfOmnidirectionalMS( alpha, beta, basepath
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Omnidirectional magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfDipoleMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Quadrupole magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfStarMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Example magnitude spectrum in star shape weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfOmnidirectionalMS( alpha, beta, basepath
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Omnidirectional magnitude spectrum';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,8 @@ function [ freqs, mags, metadata ] = dfUpperHemisphereMS( alpha, beta, basepath
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Upper hemisphere magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment