* This will generate `generate_crend_ivas_tables` executable which will be in folder [`./scripts/binauralRenderer_interface`](./scripts/binauralRenderer_interface)
* This will generate `generate_crend_ivas_tables` executable which will be in folder [`../../scripts/binauralRenderer_interface`](../../scripts/binauralRenderer_interface)
* On Windows this executable requires DLL from MATLAB, you need to add to your path `*/matlab/version/bin/win64`
* For more details on `generate_crend_ivas_tables` see [`ivas_crend_sofa_to_rom_table_converter_readme.txt`](ivas_crend_sofa_to_rom_table_converter_readme.txt).
* On Apple Silicon Mac with Intel MATLAB, it is necessary to add `SET(CMAKE_OSX_ARCHITECTURES "x86_64")` in the `CMakeLists.txt` near the top of the file. This forces the compilation to use Intel architecture instead ofo the native one.
* if find\_package do not find matlab, at the beginning of the cmakelists.txt file you can set the search path with the folowing line set(Matlab\_ROOT\_DIR matlab\_path), for example on linux set(Matlab\_ROOT\_DIR ~/MATLAB/R2023b) on mac set(Matlab\_ROOT\_DIR /Applications/MATLAB\_R2023b.app)
* On Apple Silicon Mac with Intel MATLAB, it may be necessary (if Rosetta not available) to add `SET(CMAKE_OSX_ARCHITECTURES "x86_64")` in the `CMakeLists.txt` near the top of the file. This forces the compilation to use Intel architecture instead of the native one.
* if find_package do not find matlab, at the beginning of the CmakeLists.txt file you can set the search path with the folowing line: set(Matlab\_ROOT\_DIR matlab\_path), for example on linux set(Matlab\_ROOT\_DIR ~/MATLAB/R2023b) on mac set(Matlab\_ROOT\_DIR /Applications/MATLAB\_R2023b.app)
### Build `tables_format_converter`
* Open a command line terminal
* Goto folder
* Execute
*`tables_format_converter` executable shall be in the folder [`../../scripts/binauralRenderer_interface/Table_Format_Converter/`](../../scripts/binauralRenderer_interface/Table_Format_Converter)
* Open a command line terminal and execute:
```
cd ../../scripts/binauralRenderer_interface/Table_Format_Converter
mkdir -p build
cd build
cmake ..
cmake --build . --config Release
cd ../..
```
* This will generate `tables_format_converter` executable which will be in the folder [`../../scripts/binauralRenderer_interface/Table_Format_Converter/`](../../scripts/binauralRenderer_interface/Table_Format_Converter)
* See [`README.md`](../../scripts/binauralRenderer_interface/matlab_hrir_generation_scripts/README.md) in the folder.
@@ -101,44 +107,22 @@ cd ../../..
* BRIRs sofa files for testing are stored in [`BRIRs_sofa`](BRIRs_sofa) folder
* The current scripts have not been tested with other SOFA files. For other SOFA files some adaptations of the scripts may be required. Current scripts are provided as an example.
See [`scripts/ThirdPartyLegalNotices`](../../scripts/ThirdPartyLegalNotices) for related information.
See [`scripts/thirdPartyLegalNotices`](../../scripts/thirdPartyLegalNotices) for related information.
## Usage
* Run the following MATLAB script: [`generate_ivas_binauralizer_tables_from_sofa.m`](generate_ivas_binauralizer_tables_from_sofa.m)
* It will generate ROM files that can be used to compile IVAS decoder or renderer. By default, the result is BE.
* It will also generate binary files that can be used with `-hrtf` flag in IVAS decoder or renderer command line.
* It genarates also the rom tables for the basop reposirory. Once generated they need to be copied pn an IVAS basop repo branch
* Using IVAS decoder or renderer with default binary files will generate BE output compare to the same command line without `-hrtf` flag.
* It will also generate binary files that can be used with `-hrtf` flag in IVAS decoder or renderer command line (to provide custom HRTFs).
* It generates also the rom tables for the basop repository. Once generated these need to be copied in an IVAS basop repo branch
* Using IVAS decoder or renderer with default binary files will generate BE output compared to the same command line without `-hrtf` flag.
* To test different SOFA files input you need to modify the script in the section `%% Set input files`. Other SOFA files are available in [`HRIRs_sofa`](HRIRs_sofa) folder.
***Warning**: The script will overwrite the tables in [`lib_rend`](../../lib_rend/)
***Warning**: The script will overwrite the tables in [`lib_rend`](../../lib_rend/), at least because of new dates
* The overall gain of the HRIR/BRIR must be adjusted to ensure that the IVAS codec produces an output signal with the appropriate level. For example, the levels (measured using BS1770) of the same IVAS-encoded bitstream decoded to mono, stereo, or binaural should be similar (within ±2 dB). The following scripts can be used to adjust the global level of a new set of HRIRs or BRIRs. If the HRIRs are diffuse-field equalized, a gain of approximately -3 dB is usually required.
*[`compute_HRIR_BRIR_gains.m` ](compute_HRIR_BRIR_gains.m) : allows to compute binaural output levels of mono, stereo or multichannels content. Binauralisation of mono input having a levlel of -26LKFS should be around the value within +/- 1dB. Sme for mutlichannel content having decorrelated channels.
*[`check_ivas_binaural_gains.m`](check_ivas_binaural_gains.m) : Once you have determine the gain to apply. First compile IVAS\_dec on rename it IVAS\_dec\_ref. Change the gain value in the script [`generate_ivas_binauralizer_tables_from_sofa `](generate_ivas_binauralizer_tables_from_sofa.m) and run it. The compile again IVAS\_dec. Run [`check_ivas_binaural_gains.m`](check_ivas_binaural_gains.m) to check the levels againt IVAS\_dec\_ref.
*[`compute_HRIR_BRIR_gains.m` ](compute_HRIR_BRIR_gains.m) : allows to compute binaural output levels of mono, stereo or multichannel content. Binauralisation of mono input having a level of -26LKFS should be around the value within +/- 1dB. Same for mutlichannel content having decorrelated channels. This creates levels_sofa.xls (warning: (writematrix function needs Matlab >= 2019b)
*[`check_ivas_binaural_gains.m`](check_ivas_binaural_gains.m) : Once you have determined the gain to apply. First compile IVAS\_dec and rename it IVAS\_dec\_ref. Change the gain value in the script [`generate_ivas_binauralizer_tables_from_sofa `](generate_ivas_binauralizer_tables_from_sofa.m) and run it. Then compile again IVAS\_dec. Run [`check_ivas_binaural_gains.m`](check_ivas_binaural_gains.m) to check the levels againt IVAS\_dec\_ref. This creates levels.xls (warning: (writematrix function needs Matlab >= 2019b)
→ Generated files are in folder [`binaural_renderers_hrtf_data`](binaural_renderers_hrtf_data)
* Generated files :
*`ivas_binaural_*kHz.bin`: file containing all tables values for all IVAS binaural renderers for one sample rate.
```
cd ../../scripts/binauralRenderer_interface/Table_Format_Converter