Skip to content

Legacy_Output2HRTF

Fabian Brinkmann edited this page Jul 16, 2022 · 1 revision

This part of the package includes several Matlab scripts to generate .mat and .sofa files of the BEM calculation. With Output2HRTF you can convert the output of NumCalc in a .mat and a .sofa file. After this procedure you have your HRTF in a suitable format. It includes three Matlab scripts that easly convert the previously calculated data.

Here we explain everything you need to know to use Output2HRTF for generating .sofa files:

Installation 1 add the Matlab toolbox SOFA Matlab API (or get the source code from Github to have the latest version) to your Matlab path, including its subfolders (extract the files before) 2 add the directory Output2HRTF in the source files to your Matlab path, including its subfolders

Using Output2HRTF

  1. after finishing all NumCalc calculations start the script Output2HRTF.m in your working directory

  2. after these calculations you can use the SOFA Matlab API toolbox to plot your HRTF using these: a) your_variable = SOFAload('EvaluationGrid.sofa') b) SOFAplotHRTF(your_variable, 'mode'); you can choose from the following modes to display the HRTF:

             - 'EtcHorizontal'  energy-time curve in the horizontal plane (+/- 5 deg)
             - 'EtcMedian'      energy-time curve in the median plane (+/- 2 deg)
             - 'MagHorizontal'  magnitude spectra in the horizontal plane (+/- 5 deg)
             - 'MagMedian'      magnitude spectra in the median plane (+/- 2 deg)
             - 'magspectrum'    single magnitude spectrum for direction DIR in COLOR
    

Results

  1. file: ObjectMesh.mat (comlex sound pressure on the triangules of the object)
  2. file: EvaluationGrid.sofa (complex sound pressure on the nodes of the evaluation grid)
  3. file: computationTime.mat (information on the calculation time)

Troubleshooting If Output2HRTF.m throws an error, make sure you have started the SOFA API with SOFAstart('restart');