Skip to content
Snippets Groups Projects
Commit f51fb010 authored by Lukas Aspöck's avatar Lukas Aspöck
Browse files

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

parents 49935fe6 82a4816a
No related branches found
No related tags found
No related merge requests found
Showing
with 1243 additions and 1055 deletions
......@@ -7,6 +7,7 @@ HTML
Thumbs.db
.DS_Store
*.asv
*.m~
*.wav
*.xlsx
*.docx
......@@ -14,7 +15,6 @@ Thumbs.db
*.csv
*.h5
*.ita
*.fig
*.png
*.jpeg
*.sofa
......
[submodule "internal"]
path = internal
url = https://git.rwth-aachen.de/ita/toolbox-intern.git
branch = master
#### Contributing to the ITA-Toolbox
You can contribute to the ITA-Toolbox in many ways:
* reporting bugs,
* fixing bugs,
* writing documentation,
* implementing new features,
* improving existing features.
## Reporting Bugs
* Please make sure that the [software requirements](https://git.rwth-aachen.de/ita/toolbox/blob/master/Getting_Started.txt) for using the ITA-Toolbox are fulfilled.
* You can report bugs using the [issue tracker on the projects GitLab page](https://git.rwth-aachen.de/ita/toolbox/issues) or by sending an E-Mail to the [developer mailing list](mailto:toolbox-dev@akustik.rwth-aachen.de). Make sure that your bug report is structured and includes all necessary detail for us to fix it. For guidelines on how to write a bug report take a look at [Good Bug Reports](http://martiancraft.com/blog/2014/07/good-bug-reports/). In short:
* Mention your MATLAB version, the operating system and its version.
* Choose a matching title that is descriptive for your bug.
* Give a SHORT MATLAB code snippet or figure that shows the issue.
* Give a detailed description of the problem at hand.
## Submitting Bugfixes and Features
For style guidelines and best practices in writing code for the ITA-Toolbox please take a look at the corresponding [Wiki section](https://git.rwth-aachen.de/ita/toolbox/wikis/home).
You can contribute bugfixes and features by submitting [merge requests](https://git.rwth-aachen.de/ita/toolbox/merge_requests) to the repository.
Make sure that you follow the following guidelines:
* It is highly recommended that you generate a new branch when working on a bugfix or a new feature.
* Work on your fix/feature inside your new branch.
* Create representative tests for your code if you create a new feature.
* Once finished file the merge request. Your merge request will now be reviewed and discussed.
* After all discussions are resolved and your request gets approved your code will be merged into the master branch.
File deleted
***************************************************************************************
****** Welcome to ITA-Toolbox for MATLAB ******************
***************************************************************************************
************************************************************************
******* ITA-Toolbox for MATLAB *********
************************************************************************
Please be aware of the license agreement supplied with this Toolbox (license.txt)
Please report serious bugs to toolbox-dev@akustik.rwth-aachen.de
Please be aware that by using this toolbox you accept the license
agreement supplied in the 'license.txt' file.
Please report bugs to toolbox-dev@akustik.rwth-aachen.de
***************************************************************************************
************************************************************************
** INSTALL **
***************************************************************************************
************************************************************************
In the following, MATLAB commands (to be entered in the 'command window'
will be denoted in <>. The actual command has to be entered without <>.
1) Open MATLAB R2010a or higher, with Signal Processing Toolbox
2) Navigate to this ITA-Toolbox folder, where this README.txt lies in.
3) Type <ita_toolbox_setup> in your MATLAB console
4) Follow the instructions and have a look at the GUI and Getting Started Tutorial Script supplied
Before you start make sure you unpacked the toolbox from the .zip file.
***************************************************************************************
1) Open MATLAB R2014b or higher
2) Check for Signal Processing and Curve Fitting Toolboxes are installed
(<ver>)
3) Open the ITA-Toolbox root folder (containing the current file).
4) Execute <ita_toolbox_setup>
5) Follow the instructions.
6) For an overview of available tutorials and demos:
<ita_tutorialOverview> and <ita_demoOverview>
7) To generate the documentation execute the function
<ita_generate_documentation> followed by <doc> to open it.
It might be necessary to restart MATLAB for the ITA-Toolbox
documentation to appear in the MATLAB help browser.
************************************************************************
** UNINSTALL **
***************************************************************************************
************************************************************************
To uninstall ITA-Toolbox for MATLAB:
1) type <ita_delete_toolboxpaths>
OR
simply type <pathtool> in your MATLAB console and delete all path entries for ITA-Toolbox and save path list.
1) <ita_toolbox_uninstall>
2) Close MATLAB.
3) Delete your ITA-Toolbox folder
***************************************************************************************
************************************************************************
** Have fun! **
***************************************************************************************
************************************************************************
Your ITA-Toolbox Developer Team
Aachen, Germany, February 2013
\ No newline at end of file
File deleted
# ITA-Toolbox
Welcome to the ITA-Toolbox
Welcome to the ITA-Toolbox, an open source MATLAB toolbox for acoustics developed by the [Institute of Technical Acoustics](http://www.akustik.rwth-aachen.de/) of the [RWTH Aachen University](http://www.rwth-aachen.de/).
* Open source project developed by the [Institute of Technical Acoustics](http://www.akustik.rwth-aachen.de/), [RWTH Aachen University](http://www.rwth-aachen.de/).
* Full-fledged Toolbox, well-integrated in the MATLAB environment.
* Including demo files, documentation and tutorials to get started quickly.
* Deals with playable audio files or simulation data (including physical unit calculation and spatial information).
* A graphical user interface and various plot routines for the graphical output of all kind of relevant acoustic data.
* Object-oriented programming concepts for using of well-known MATLAB commands and operators to audio data.
* Makes it easy to do basic signal analysis and processing, record and playback audio files and much more...
[Project Website](http://www.ita-toolbox.org)
You can find the first instructions how to deal with the ITA-Toolbox in the [Getting Started](ITA_Toolbox_Getting_Started.pdf) file.
[Wiki](https://git.rwth-aachen.de/ita/toolbox/wikis/home)
[Setup Instructions](Getting_Started.txt)
\ No newline at end of file
File added
......@@ -26,6 +26,8 @@ classdef itaHRTF < itaAudio
%
% nPoints total number of directions
%
% mMetadata stored metadata from a loaded daff file
%
% itaHRTF Methods (find & select directions):
% HRTFfind = findnearestHRTF(varargin)
% HRTFdir = direction(idxCoord)
......@@ -71,6 +73,7 @@ classdef itaHRTF < itaAudio
% Created: 10-Jul-2014
properties (Access = private)
mMetadata = [];
mCoordSave = [];
mChNames = [];
mDirCoord = itaCoordinates;
......@@ -292,7 +295,7 @@ classdef itaHRTF < itaAudio
pairs = zeros(coord.nPoints/2,2);
if coord.nPoints>10000 % takes a while
ita_verbose_info([num2str(coord.nPoints) ' Points has to be sorted ...please wait...'], 0);
ita_verbose_info([num2str(coord.nPoints) ' Points have to be sorted ...please wait...'], 0);
end
......@@ -354,7 +357,7 @@ classdef itaHRTF < itaAudio
function this = set.openDAFF2itaHRTF( this, daff_file_path )
try_daff_old_version = false;
metadata=[];
% First try new version (v17)
try
handleDaff = DAFFv17( 'open', daff_file_path );
......@@ -363,11 +366,15 @@ classdef itaHRTF < itaAudio
counter = 1;
data = zeros(props.filterLength,props.numRecords*2,'double' ) ;
coordDaff = zeros(props.numRecords,2) ;
for iDir = 1:props.numRecords
data(:,[counter counter+1]) = DAFFv17( 'getRecordByIndex', handleDaff,iDir )';
coordDaff(iDir,:) = DAFFv17( 'getRecordCoords', handleDaff, 'data', iDir )';
counter= counter+2;
end
tempMetadata=DAFFv17('getMetadata', handleDaff);
catch
disp( 'Could not read DAFF file right away, falling back to old version and retrying ...' );
try_daff_old_version = true;
......@@ -381,6 +388,7 @@ classdef itaHRTF < itaAudio
counter = 1;
data = zeros(props.filterLength,props.numRecords*2,'double' ) ;
coordDaff = zeros(props.numRecords,2) ;
tempMetadata=DAFFv15('getMetadata', handleDaff);
for iDir = 1:props.numRecords
data(:,[counter counter+1]) = DAFFv15( 'getRecordByIndex', handleDaff,iDir )';
coordDaff(iDir,:) = DAFFv15( 'getRecordCoords', handleDaff, 'data', iDir )';
......@@ -389,6 +397,22 @@ classdef itaHRTF < itaAudio
end
% Proceed (version independent)
names=fieldnames(tempMetadata);
for k=1:(numel(names))
switch class(tempMetadata.(names{k}))
case 'logical'
datatype='bool';
case 'char'
datatype='string';
case 'double'
if rem(tempMetadata.(names{k}),1)==0
datatype='int';
else
datatype='float';
end
end
metadata=daffv17_add_metadata(metadata,cell2mat(names(k)),datatype,tempMetadata.(names{k}));
end
phiM = coordDaff(:,1)*pi/180;
%phiM = mod(coordDaff(:,1),360)*pi/180;
......@@ -408,6 +432,7 @@ classdef itaHRTF < itaAudio
chCoord.theta(1:2:2*props.numRecords) = thetaM;
chCoord.theta(2:2:2*props.numRecords) = thetaM;
this.mMetadata = metadata;
this.data = data;
this.mDirCoord = itaCoordinates([radius thetaM phiM],'sph');
this.channelCoordinates = chCoord;
......@@ -735,14 +760,18 @@ classdef itaHRTF < itaAudio
end
function surf(varargin)
sArgs = struct('pos1_data','itaHRTF', 'earSide', 'L', 'freq' , 5000,'type','directivity');
sArgs = struct('pos1_data','itaHRTF', 'earSide', 'L', 'freq' , 5000,'type','directivity','log',1);
[this,sArgs] = ita_parse_arguments(sArgs,varargin);
idxF = this.freq2index(sArgs.freq);
position = get(0,'ScreenSize');
figure('Position',[10 50 position(3:4)*0.85]);
if sArgs.log
freqData_dB = this.getEar(sArgs.earSide).freqData_dB;
else
freqData_dB = this.getEar(sArgs.earSide).freqData;
end
switch sArgs.type
case 'directivity'
surf(this.dirCoord,freqData_dB(idxF,:));
......@@ -759,6 +788,11 @@ classdef itaHRTF < itaAudio
end
function display(this)
if numel(this) == 0
disp('****** nothing to do, empty object ******')
elseif numel(this) > 1
disp(['size(' inputname(1) ') = [' num2str(size(this)) ']; (for full display, pick a single instance)']);
else
this.displayLineStart
this.disp
......@@ -770,6 +804,8 @@ classdef itaHRTF < itaAudio
fprintf([middleLine '\n']);
end
end
function disp(this)
disp@itaAudio(this)
......@@ -1459,5 +1495,3 @@ classdef itaHRTF < itaAudio
end
end
......@@ -6,7 +6,7 @@ function [ data, samplerate, metadata ] = dfitaHRIRDAFFDataFunc( alpha, beta, it
% DAFF requires data alignment by multiple of 4
nResidual = mod( hrtf.nSamples, 4 );
data = [ hrtf.timeData', zeros( hrtf.nChannels, 4 - nResidual ) ];
data = [ hrtf.timeData', zeros( hrtf.nChannels, mod(4 - nResidual,4) ) ];
metadata = [];
end
......@@ -9,7 +9,7 @@ function writeDAFFFile( this, file_path, metadata_user )
%
% Output: none
metadata = [];
metadata = this.mMetadata;
if nargin >= 3
metadata = metadata_user;
end
......@@ -44,34 +44,44 @@ end
theta_start_deg = rad2deg( min( this.channelCoordinates.theta ) );
theta_end_deg = rad2deg( max( this.channelCoordinates.theta ) );
theta_num_elements = size( unique( this.channelCoordinates.theta ), 1 );
theta_num_elements = size( uniquetol( this.channelCoordinates.theta ), 1 );
phi_start_deg = rad2deg( min( mod( this.channelCoordinates.phi, 2 * pi ) ) );
phi_end_deg = rad2deg( max( mod( this.channelCoordinates.phi, 2 * pi ) ) );
phi_num_elements = size( unique( this.channelCoordinates.phi ), 1 );
phi_num_elements = size( uniquetol( this.channelCoordinates.phi ), 1 );
assert( phi_num_elements ~= 0 );
alphares = ( phi_end_deg - phi_start_deg ) / phi_num_elements; % phi end does not cover entire circle in this case
alphares_full_circle = ( phi_end_deg - phi_start_deg ) / ( phi_num_elements - 1 ); % phi end does not cover entire circle in this case
if phi_end_deg + alphares_full_circle >= 360.0
alpharange = [ phi_start_deg ( phi_end_deg + alphares_full_circle ) ]; % Account for full circle
alpharange = [ phi_start_deg 360 ]; % Account for full circle and force end of range to 360 deg
alphares = alphares_full_circle;
else
alpharange = [ phi_start_deg phi_end_deg ];
end
assert( alpharange( 1 ) >= 0.0 )
assert( alpharange( 2 ) <= 360.0 )
assert( theta_num_elements ~= 0 );
betares = ( theta_end_deg - theta_start_deg ) / ( theta_num_elements - 1 ); % phi end does not cover entire circle
betarange = 180 - [ theta_start_deg theta_end_deg ]; % Flip poles (DAFF starts at south pole)
assert( betarange( 2 ) >= 0.0 )
assert( betarange( 1 ) <= 180.0 )
%% Assemble metadata
metadata = daffv17_add_metadata( metadata, 'Generation script', 'String', 'writeDAFFFile.m' );
metadata = daffv17_add_metadata( metadata, 'Generation toolkit', 'String', 'ITA-Toolkit' );
metadata = daffv17_add_metadata( metadata, 'Generation date', 'String', date );
metadata = daffv17_add_metadata( metadata, 'Web resource', 'String', 'http://www.ita-toolkit.org' );
channels = 2; % this.nChannels < does not work?
channels=this.nChannels/this.nDirections;
if(channels<1)
warning('Number of channels per record was not detected correctly, assuming 2 channel records');
channels = 2;
end
% Content type switcher between time domain (ir) and frequency domain (dft)
% (requires different data functions)
......
......@@ -41,7 +41,7 @@ HRTF_find.play_gui(pinkNoise);
%% Binaural parameters
ITD = slicePhi.ITD; % different methods are available: see method in itaHRTF
ILD = slicePhi.ILD;
%ILD = slicePhi.ILD;
%% Modifications
% calculate DTF
......@@ -65,8 +65,12 @@ HRTF_interp = HRTF_sphere.interp(coordI);
nameDaff_file = 'HRTF_sphere.daff';
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';
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
......@@ -47,7 +47,7 @@ classdef itaHpTF < itaAudio
if nargin == 1
% init
if isa('itaHpTF',this)
if isa(this,'itaHpTF')
this.init = varargin;
end
end
......
......@@ -45,10 +45,10 @@ classdef itaHpTF_MS < itaHpTF
this.MSTF.outputChannels = [1 2];
if nargin == 1
% init
if isa('itaHpTF',varargin)
if isa(varargin{1},'itaHpTF')
this.init = varargin;
elseif isa('itaMSTF',varargin) % calibration input
this.MSTF = varargin;
elseif isa(varargin{1},'itaMSTF') % calibration input
this.MSTF = varargin{1};
end
this.dimensions = 2*this.repeat;
this.fftDegree = this.MSTF.fftDegree;
......
function output = ita_headphone_equalization(HPTF,type)
% <ITA-Toolbox>
% This file is part of the application HRTF_Measurement for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
output = HPTF(1,1);
for cdx = 1:HPTF(1,1).nChannels
hp = merge(HPTF.ch(cdx));
switch type
case 'mean'
hp.freqData = mean(abs(hp.freqData),2);
case 'max'
hp.freqData = max(abs(hp.freqData),[],2);
case 'mSTD'
hp.freqData = mean(abs(hp.freqData),2) + 2*std(abs(hp.freqData),0,2);
otherwise
error('Unknown type');
end
%% Short Filter with no correction for low freqs and minimun phase
R = hp;
% R = ke4;
n = R.nSamples;
aux = max(abs(R.freqData),[],2);
% find first maximum and truncate low freq correction at this point
idx1 = find(R.freqVector > 100,1,'first');
idx2 = find(R.freqVector < 300,1,'last');
d_aux = diff(aux(idx1:idx2));
idx = find(diff(sign(d_aux)) ~= 0,1,'first');
aux(1:idx1+idx+1) = aux(idx1+idx+2);
aux(aux==0) = rand(1)*eps;
R.freqData = aux;
% do smoothing
%R = ita_smooth(R,'LogFreqOctave1',1/6,'Abs');
R = ita_invert_spk_regularization(R,[0 18000],'beta',.01);
% minimum phase
R = ita_time_shift(R,n/2,'samples');
R = ita_extend_dat(R,R.nSamples*2);
R = ita_time_shift(R,-n/2,'samples');
N = 2*n;
aux = R.timeData;
R.timeData = ifft(log(abs(fft(aux))));
T = 2^16;
if T >= N-3
T = N-3;
end
if rem(T-1,2) == 1
T = T+1;
end
u = [1; 2*ones((N-T-1)/2,1); cos(pi*(0:T-1)'/T)+1; zeros((N-T-1)/2,1)]; %pode colocar uma transicao mais suave no meio.
R.timeData = R.timeData.*u;
H = R;
H.timeData = ifft(exp(fft(R.timeData)),'symmetric');
H = ita_time_crop(H,[1 n],'samples');
% H = ita_time_window(H,[2^12 2^13],'samples');
% H = ita_time_window(H,[0.1 0.2],'time','dc',true);
H = ita_time_window(H,[2^9 2^10],'samples');
H.channelUnits = {''};
% It is necessary to correct the overall level of the filter
% we can either guaranty no gain
% H = H/max(abs(H.freqData));
% spl = ita_spk2level(H,3,'averaged');
%
% H = H/mean(spl.data);
output.freqData(:,cdx) = H.freqData;
end
% or guaranty that the average level of the signal is not altered
% this also means that the overall loudness of the signal will not be
% considerably altered.
% output = output/norm(output.rms);
\ No newline at end of file
Contact: mpo@akustik.rwth-aachen.de
Description: experimental classes for bulky audio data
Dependencies: no dependencies
\ No newline at end of file
Contact: pdi@akustik.rwth-aachen.de
Description: generates documentatation: ita_generate_documentation
Dependencies: no dependencies
\ No newline at end of file
applications/HTMLhelp/ExternalPackages/m2html/doc/alpha.png

273 B

applications/HTMLhelp/ExternalPackages/m2html/doc/c++.png

327 B

applications/HTMLhelp/ExternalPackages/m2html/doc/c.png

252 B

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment