Commit c78cf290 authored by Gregory Pallone's avatar Gregory Pallone
Browse files

initial version

parent 95a776dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
clear -regexp ^((?!writeRomFileOutput|makeBE|performDiffuseFieldEq|normalize|writeBinaryOutput|writeRomFileFx|makeFxFltBE|generateBinaryFile|generateCustomBinaryFile|writeEachRendererBinaryOutput|fx_rom_file|rom_file|bin_file|hrir_file|brir_file|ivas_path|binary_path|output_bin_name|param_bin_file|fastconv_bin_file|td_binary_file|binary_name|rom_path).)*$
clear -regexp ^((?!writeRomFileOutput|max_band|brir_gain|makeBE|performDiffuseFieldEq|normalize|writeBinaryOutput|writeRomFileFx|makeFxFltBE|generateBinaryFile|generateCustomBinaryFile|writeEachRendererBinaryOutput|fx_rom_file|rom_file|bin_file|hrir_file|brir_file|ivas_path|binary_path|output_bin_name|param_bin_file|fastconv_bin_file|td_binary_file|binary_name|rom_path).)*$
+5 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
%   the United Nations Convention on Contracts on the International Sales of Goods.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function FastConv_SD_BRIR = generate_BRIR_CLDFB_FASTCONV(sofa_file, max_band)
function FastConv_SD_BRIR = generate_BRIR_CLDFB_FASTCONV(sofa_file, max_band, brir_gain)
%% generate_BRIR_CLDFB_FASTCONV(rom_c_file, sofa_file): 
% script for getting the binaural room impulse response coefficients in CLDFB domain
% - loads sphere-samples BRIRs given in sofa_file (must match requested speaker positions!)
@@ -42,6 +42,9 @@ end
if ~exist('max_band', 'var') || isempty(max_band)
    max_band = 50;
end
if ~exist('brir_gain', 'var') || isempty(brir_gain)
    gain = 1;
end

%% Load CLDFB protopyte
load('cldfb_prototype.mat');
@@ -55,6 +58,7 @@ sofaData.readSOFA(char(sofa_file),'Combined',false);
ls_struct = get_ls_layout_config('Combined');

IR = permute(sofaData.Data.IR(:,:,:), [3 2 1]) ;
IR = IR * brir_gain;

% match required loudspeaker positions
brirAziRad = sofaData.PosSpherical(1, :).';
+7 −1
Original line number Diff line number Diff line
@@ -77,6 +77,12 @@ end
if ~exist("brir_file",'var')
    brir_file = fullfile('..', 'BRIRs_sofa', 'IIS_BRIR_officialMPEG_Combined.sofa');
end
if ~exist("max_band",'var')
    max_band = 50;
end
if ~exist("brir_gain",'var')
    brir_gain = 1;
end

if ~exist("ivas_path",'var')
    ivas_path = ['..' filesep '..' filesep '..' filesep]; 
@@ -114,7 +120,7 @@ end

%% Generate C-code tables for RENDERER_BINAURAL_FASTCONV_ROOM (SD)
disp('Processing BRIRs (SD) for FastConv renderer...');
FastConv_SD_BRIR_float = generate_BRIR_CLDFB_FASTCONV(brir_file);
FastConv_SD_BRIR_float = generate_BRIR_CLDFB_FASTCONV(brir_file,max_band,brir_gain);
if generateCustomBinaryFile == false
    FastConv_SD_BRIR_float.rev_param.rt60 = [0.420013, 0.206696, 0.203613, 0.207458, 0.217255, 0.236176, 0.230164, 0.228912, 0.228210, 0.219788, 0.225983, 0.220184, 0.222015, 0.223114, 0.223572, 0.227478, 0.227905, 0.223450, 0.219910, 0.218597, 0.220428, 0.218262, 0.213257, 0.210327, 0.207428, 0.198761, 0.196259, 0.194916, 0.190338, 0.184509, 0.180328, 0.176178, 0.176514, 0.177582, 0.183594, 0.195923, 0.203247, 0.208405, 0.214661, 0.220001, 0.222931, 0.230408, 0.233917, 0.233643, 0.236328, 0.237427, 0.241638, 0.241119, 0.238861, 0.242371, 0.247253, 0.245941, 0.248566, 0.245392, 0.243958, 0.244110, 0.239014, 0.241791, 0.234833, 0.253052];
    FastConv_SD_BRIR_float.rev_param.nrgLr = [0.000579833984, 0.000213623047, 0.000244140625, 0.000213623047, 0.000244140625, 0.00152587891, 0.00115966797, 0.00109863281, 0.0012512207, 0.00131225586, 0.00231933594, 0.00244140625, 0.00268554688, 0.00271606445, 0.00262451172, 0.00256347656, 0.00274658203, 0.00271606445, 0.00259399414, 0.00253295898, 0.00341796875, 0.00177001953, 0.0009765625, 0.000701904296, 0.000610351563, 0.000549316406, 0.000518798828, 0.000579833984, 0.000610351563, 0.000549316406, 0.0012512207, 0.00122070313, 0.000946044921, 0.000610351563, 0.000274658203, 0.0000915527343, 0.0000610351563, 0.0000610351563, 0.0000305175781, 0.0000305175781, 0.0000305175781, 0.0000305175781, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
+2 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ performDiffuseFieldEq = true; % at true perform diffuse field equalization durin
writeRomFileOutput = true & ~generateCustomBinaryFile; %% generation of rom files if true
writeBinaryOutput = true; %% generation of binary files if true. Always true for TD renderer
writeEachRendererBinaryOutput = false; %% generation of binary split files each containing binary data for individual renderer 
brir_gain = 10^(6.5/20)
%% Set ivas root path
ivas_path = ['..' filesep '..' filesep];

@@ -130,7 +131,7 @@ Mod_Hrf_Itd_Main(dataSpec);

%% generate crend rom  or binary values
SOFA_save_to_mat(hrir_file);
SOFA_save_to_mat(brir_file,'Combined');
SOFA_save_to_mat(brir_file,'Combined', brir_gain);

if generateCustomBinaryFile
    convert_SD2SHD_HRIRs(hrir_path,hrir_file_name,-1,normalize);
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function [T60, lateEnes, earlyEnes] = generate_BRIR_in_SHD_CLDFB_PARAMETRIC(brir_inputfile, SHhrtf,normalize, makeBE)
function [T60, lateEnes, earlyEnes] = generate_BRIR_in_SHD_CLDFB_PARAMETRIC(brir_inputfile, SHhrtf,normalize, makeBE, brir_gain)
% 
% [T60, lateEnes, earlyEnes] = generate_BRIR_in_SHD_CLDFB_PARAMETRIC(brir_inputfile, SHhrtf)
%
@@ -47,6 +47,7 @@ sofaData.readSOFA(brir_inputfile,'Combined',normalize);
%% Get data and format it for us
% Input VRIR data from SOFA. After permuation, in order (response, ear, dirIndex)
brirs = permute(sofaData.Data.IR(:, :, :), [3 2 1]);
brirs = brirs * brir_gain;

% Sampling rate of the BRIR set. Currently only checked.
brirFS = sofaData.Data.SamplingRate;
Loading