Adding TUB FABIAN to OpenDAFF v17 converter scripts with HATO support (channel-based layout)

parent ca2d195b
function [] = daffv17_convert_from_aktools( target_file_path, export_properties, additional_metadata )
export_properties.samplerate = 44100;
export_properties.numchannels = 2 * ceil( ( export_properties.hatorange( 2 ) - export_properties.hatorange( 1 ) ) / export_properties.hatores + 1 );
combined_metadata = daffv17_add_metadata( additional_metadata, 'Converter script', 'String', 'daffv17_convert_from_aktools.m' );
combined_metadata = daffv17_add_metadata( combined_metadata, 'Conversion date', 'String', date );
daffv17_write( 'filename', target_file_path, ...
'datafunc', @dfAKtools, ...
'userdata', export_properties, ...
'metadata', combined_metadata, ...
'content', 'ir', ...
'alphares', export_properties.alphares, ...
'alpharange', export_properties.alpharange, ...
'betares', export_properties.betares, ...
'betarange', export_properties.betarange, ...
'orient', [ 0 0 0 ], ...
'channels', export_properties.numchannels, ...
'quantization', 'float32' );
function [ data, samplerate, metadata ] = dfAKtools( alpha, beta, config )
%DFAKTOOLS Summary of this function goes here
% Retrieves data from FABIAN via AKtools using AKhrirInterpolation
% routine for azimuth, elevation and head-above-torso orientation
% First two channels are always neutral hato position (for backwards
% compatibility)
% Define range angle vector with neutral direction as first entry
assert( config.hatorange( 1 ) <= 0 && config.hatorange( 2 ) >= 0 )
hato_negative_range = config.hatorange( 1 ):config.hatores:-config.hatores;
hato_positive_range = config.hatores:config.hatores:config.hatorange( 2 );
hato = [ 0 hato_negative_range hato_positive_range ];
[ l, r ] = AKhrirInterpolation( alpha, beta - 90, hato );
l = l';
r = r';
% Interleave for DAFF (odd = left, even = right)
data = reshape( [ l(:) r(:) ]', 2 * size( l, 1 ), [] );
samplerate = config.samplerate;
metadata = daffv17_add_metadata( [], 'AKhrirInterpolation_hato_parameter', 'STRING', num2str( hato ) );
end
%% Pull in FABIAN database from AKtools
% Resources
% http://dx.doi.org/10.14279/depositonce-5718.2
% http://www.ak.tu-berlin.de/menue/digitale_ressourcen/research_tools/aktools/
AKdependencies('FABIAN')
%% Configure
export_properties = struct();
export_properties.alphares = 5;
export_properties.alpharange = [0 360];
export_properties.betares = 5;
export_properties.betarange = [0 180];
export_properties.hatores = 5;
export_properties.hatorange = [-40 40];
%% Set up metadata
additional_metadata = daffv17_add_metadata( [], 'hato', 'BOOL', true );
additional_metadata = daffv17_add_metadata( additional_metadata, 'hato_res_deg', 'FLOAT', export_properties.hatores );
additional_metadata = daffv17_add_metadata( additional_metadata, 'hato_start_deg', 'FLOAT', export_properties.hatorange( 1 ) );
additional_metadata = daffv17_add_metadata( additional_metadata, 'hato_end_deg', 'FLOAT', export_properties.hatorange( 2 ) );
additional_metadata = daffv17_add_metadata( additional_metadata, 'AKtools_resource', 'STRING', 'http://www.ak.tu-berlin.de/menue/digitale_ressourcen/research_tools/aktools/' );
additional_metadata = daffv17_add_metadata( additional_metadata, 'FABIAN_resource', 'STRING', 'http://dx.doi.org/10.14279/depositonce-5718.2' );
additional_metadata = daffv17_add_metadata( additional_metadata, 'FABIAN_license', 'STRING', 'Creative Commons BY-NC-SA 4.0' );
%% Export
daffv17_convert_from_aktools( 'FABIAN_HATO_5x5x5_256_44100Hz.v17.ir.daff', export_properties, additional_metadata )
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