Skip to content

Basic_HRTF_tutorial

Sergejs edited this page Apr 29, 2023 · 7 revisions

Complete Beginner’s tutorial for Mesh2HRTF v1

How to create professional quality individual HRTF using only free software, a computer and a smartphone.

------------------------------------------------------------ Part of the the Complete Beginner’s tutorial ------------------------------------------------------------
Start here. last updated in 2023-04-29 Next >>> Installation of Mesh2HRTF

The Tutorial Introduction:

vid1


  1. Introduction
  2. Main Tutorial Contents
  3. Additional HRTF help (SOFA Application notes)

Introduction

This tutorial contains a complete beginner’s workflow from nothing to an accurately simulated individual HRTF (Head Related Transfer Function). The result is - industry standard “HRIR.sofa” and "HRTF.sofa" files that can be used for example to:

  • Listen to accurate immersive/surround sound over headphones that also supports full 3D head-tracking - yaw, pitch, and roll. (Mesh2HRTF provides far more accurate and reliable results than consumer-level immersive or virtual surround products.)

  • Get key information for the optimal headphone target curve for a specific person.

  • Simulate any number of sound locations (virtual speakers) for computer gaming, music listening, movie watching, virtual reality (VR), AR, ambisonics (HOA), music/sound production, audio research, critical listening, binaural monitoring, and more.

For researchers and expert users there is also the main Mesh2HRTF Tutorial. In contrast, this tutorial does not assume any prior knowledge and provides just one example workflow how Mesh2HRTF can be used to simulate HRTF. Mesh2HRTF can simulate not only HRTFs and when Mesh2HRTF is used for audio research, some of the statements in this beginner's tutorial may not apply at all.

Mesh2HRTF workflow requirements

  1. A simulation computer (Linux, Mac or Windows) with at least 16GB of RAM. Recommended 32GB or even more system memory (RAM).

  2. Accurate 3D mesh of individual’s ears and head shape (OR try example 3D mesh that is a ready for testing Mesh2HRTF). Such 3D scan can be acquired by:

    1. Using FaceID camera and ~10 USD app on most recent Apple iPhone models (process is described in detail in this tutorial).

    2. Using a dedicated 3D scanner (note, that not all professional 3D scanners are suitable for this application and even the best 3D scanners can produce poor results if operator is not careful at the task).

    3. Any other method that gives sufficient quality 3D details of the ear shape. (more details in the tutorial)

  3. Free, open-source Mesh2HRTF software package that contains:

    1. standalone solver “NumCalc” which actually calculates HRTF from the given 3D mesh,

    2. Extra modules for other open-source software that is necessary for Mesh2HRTF (for Blender and Python, plus some optional modules for other software).

  4. Some additional free or open-source software for cleaning-up 3D Mesh and testing/listening to the resulting SOFA file .

Additional notes

  • These instructions are primarily **focused on Windows **(but should work great for Linux / Mac as well), but the preffered platforms of the Mesh2HRTF project team are Linux and Mac. Therefore use of Mesh2HRTF on Linux or Mac is encouraged and you can find all necessary instructions for Linux / Mac in this Wiki.

  • The written tutorial may contain improvements and corrections that are not reflected in the videos.

  • Each step of the workflow can be performed on different computers and different operating systems. Only the simulation step requires large amounts of RAM.

  • The main calculations can take many hours or even days – depending on how high resolution of simulation is used. But it is possible to interrupt simulations and resume them at any point (to free up computer when needed). Also it is possible to distribute each simulation over at least 2 computers to reduce simulation time (with any operating system combinations.

  • This tutorial uses only open-source or free software with exception of 3D scanning part – there you may need to buy one phone app or find another 3D scanning solution.

Important updates to this tutorial

This list provides a very high-level change log - relevant only for users who have previously followed this tutorial and want to see what has changed since.

  • 2023-04-29 - Updated links to the Release version of Mesh2HRTF. Minor changes only.
  • 2022-09-05 - Tutorial & code fully updated to v1.0 release - tutorial is safe to use with the latest Develop branch of code. Note, due to major changes, it is necessary to re-download and re-install both Python and Blender code to use Mesh2HRTF.
  • 2022-07-01 - Mesh2HRTF project started major changes in the codebase that were not compatible with this tutorial at that point (no longer relevant since 2022-09-05).
  • 2022-06-06 - Finished the video tutorials - 11 videos for the basic HRTF tutorial.
  • 2022-05-16 - Important fixes to the Python post-processing have been uploaded. Please re-download both Mesh2HRTF code from GitHub and Mesh2hrtf-tools ( “finalize_hrtf_simulation.py” should be version 2.05 or higher). Note that If you already have working simulated HRTF, then there is no need to re-process anything.
  • 2022-04-14 - new Mesh2HRTF code revision is now hosted on GitHub - all download links updated and the new code requires re-installation of Mesh2HRTF.
  • 2022-03-28 - finished the whole basic written tutorial.
  • 2022-03-02 - published the 1st page of this tutorial (initial text was started back in 2021-08).
  • 2022-02-20 - published the 1st Mesh2HRTF video.

Main Tutorial Contents

How to install Mesh2HRTF. Link

How to 3D scan the ears and head for Mesh2HRTF. Link

Note: Example 3D mesh is available for simulation. If you would like to test Mesh2HRTF without 3D scanning - download the example high-quality 3D scan of a Kemar dummy and jump straight to: https://youtu.be/wRvSooD0n0E?t=641 .

How to process the raw scanned data into a complete 3D model for Mesh2HRTF. Link

How to re-mesh (grade) the 3D data for the simulation. Link

How to generate the simulation input data and choose the right settings. Link

How to run the simulation (which can load one or more computers for many hours). Link

How to run post-processing to generate the HRTF and HRIR .sofa files out of the raw simulation results. Link

After this step you will have your individual HRTF.


Additional HRTF help

These "SOFA Application notes" provide additional guidance how to test .sofa HRIR files and listen to the results in some common scenarios.

Short primer on the possibilities and limitations of individual HRTFs. Link

#2 – Quick listening test & DAW setup

To quickly listen to some audio using individual HRTF .sofa file - Try Reaper DAW (or any suitable VST host) and apply SPARTA Binauraliser VST plugin (see this screenshot)to hear all audio through the individual HRTF .sofa file (with optional headtracking). For more details how to configure SPARTA Binauraliser, check this tutorial. Detailed step-by-step tutorial does not exist, but it is actually very simple to set up.

Overview of how to make use of HRTF for all audio content on a Windows PC (music listening, surround sound from video, immersive content production, gaming). Link

HRTF Usage

Tutorial how to achieve system-wide binauralized 7.1 sound over headphones with optional headtracking that uses any SOFA HRTF and optional individual headphone calibration. Link

(Work in progress) How to fine-tune and equalize individual HRTFs for the best results. Tip - check the Genelec Aural ID user manual for an example of one purely manual method to equalize the HRTF. Link

NOTE - Mesh2HRTF outputs flat HRTFs - the expected frequency response from headphones at the in-ear microphone position is completely flat. Therefore additional headphone equalization is required - preferably headphone & listener specific EQ or at least generic inverse "diffuse field" equalization.

SOFA files from Mesh2HRTF can be easily converted to HeSuVi format to be directly used and compared to most commercial virtual surround solutions. Link


Next tutorial step >>> Installation of Mesh2HRTF