Menu

Express_Basic_HRTF_tutorial

Sergejs

Complete Beginner’s tutorial - EXPRESS version

NOTE, this is only a brief overview of the complete tutorial. No need to read this if you intend to read all parts of the Complete Beginner’s tutorial.

------------------------------------------------------------ | Part of the the Complete Beginner’s tutorial | --------------------------------------------------------


These are the express instructions for a suggested way to run Mesh2HRTF project on Windows computer(s). (On Linux and MacOS it is possible to do the same steps, but there may be differences in how exactly certain steps should be performed.)

  1. Installation - Make sure the necessary tools are installed.

  2. 3D mesh - Prepare high-quality, air-tight 3D mesh of the ears and head for simulation. This usually involves 3D scanning and 3D mesh clean-up and merging:

    • Ear 3D shape should be highly detailed (preferably better than 1mm resolution and data accuracy).

    • The head itself can be much less detailed (2 mm or even rougher resolution is still good).

    • It is enough to simulate just the head, but it is possible to also include shoulders or the complete torso if needed. There are pros & cons for including shoulders in the simulation, so there is no right or wrong answer at this point.

    • Important that head mesh should be smooth – hair, glasses and other non-skin surfaces should be excluded from the simulation.

    • Ear canal opening should appear as if it smoothly plugged-shut at the entrance.

  3. Import and correctly position the 3D mesh into the Blender template file.

  4. Optimize the 3D mesh – grade the mesh for simulation and leave correct amount of details. The recommended approach is to use specially developed “hrtf_mesh_grading” algorithm for adaptive re-meshing of each ear.

    • “hrtf_mesh_grading” requires correctly positioned and rotated head mesh to produce correct output.

    • On Windows - just double-click “- run_hrtf_mesh_grading.bat” to directly re-mesh your high-quality 3D mesh as long as the input file with a filename “3Dmesh_orig.ply” is available next to the .bat file (grading can process any input mesh with even millions of triangles within just a few seconds).

    • Default grading settings will give 30-60k triangles which produces great results but may not be very fast. (edit the .bat file to get access to the settings to further speed up the simulation by reducing mesh quality).

  5. Double-check that re-meshing was completed without artifacts by examining both left and right output 3D meshes (certainly relevant for “hrtf_mesh_grading” algorithm):

  6. Create Mesh2HRTF project – Export left and right side Mesh2HRTF projects from Blender using, one of the recommended methods .

    • Note – it is strongly recommended to simulate each ear in a separate simulation for performance reasons and for the best possible software support (as described in this tutorial).
  7. Run the simulation – launch “NumCalcManager.py” right next-to the two Mesh2HRTF project folders (for left and right sides).

    • Remember that total simulation time is almost directly proportional to the total amount of RAM available on the computer and you can easily simulate left and right sides on different computers to speed up the simulation.

    • For diagnostics – open the “Nc … _log.txt” files of the first running simulation steps. Every 10 simulation iterations there will be a printout with “Abs Error” as the simulation is trying to converge towards a precise solution. Usually an HRTF simulation should take under 100 iterations to reach the solution. If you notice that simulations do not converge – it usually indicates some defect in the input 3D mesh and you should interrupt the simulation as the results will almost certainly be unusable (assuming non-convergence happens at normal frequencies - under 24kHz, at higher frequencies it is different).

  8. Generate SOFA files – Run “finalize_HRTF_simulation.py” to execute full Python post-processing which converts NumCalc simulation results into usable SOFA files:

    1. Move both (left & right side) Mesh2HRTF project folders into a folder that contains “finalize_HRTF_simulation.py”.

    2. Run "finalize_HRTF_simulation.py" in the correct Python environment (environment where you installed “mesh2hrtf” package).

    3. Done. The final SOFA files and diagnostic files will be saved in a path displayed in the printouts of the "finalize_HRTF_simulation.py" script.

      • NOTE: most software that supports .sofa files actually expects the "HRIR.sofa" files even if it may be referred to as "HRTF".

      • NOTE: The resulting sofa files assume completely flat headphone response on input. To use these files, at least a basic "diffuse field" equalization needs to be applied (such as available in Sparta Binauralizer) or use even more sophisticated headphone EQs.

End.


For additional details and context, please view the full Complete Beginner’s tutorial.


Related

Wiki: Basic_3D_Mesh_cleanup_and_merging
Wiki: Basic_3D_optimization_and_ReMeshing
Wiki: Basic_HRTF_NumCalc_Simulation
Wiki: Basic_HRTF_post_processing
Wiki: Basic_HRTF_tutorial
Wiki: Basic_Project_export
Wiki: Basic_tutorial_3d_scanning
Wiki: Installation_2