Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOFA-to-MHR conversion issues #1028

Open
Kekkin opened this issue Aug 6, 2024 · 3 comments
Open

SOFA-to-MHR conversion issues #1028

Kekkin opened this issue Aug 6, 2024 · 3 comments

Comments

@Kekkin
Copy link

Kekkin commented Aug 6, 2024

I was going to see whether the latest artifact that fixed issues from #1027 can handle the SOFA variant of the IRCam sets, from the SOFAcoustics database (particularly interested in Listen's IRC_1037). Unfortunately though, MakeMHR reports of an unsupported format. The problem also exhibits in other IRCam sets.
image
This doesn't happen with IRC_1037 taken from v0.6 of the SOFA database.

Going on to see whether the SOFAs of other sets are also affected from SOFAcoustics' latest DB, I tested RIEC's, FHK's, and the SADIE set. RIEC fails with this constant error (according to ThreeDeeJay, it could be related to this: #779)
image
These FHK sets that I've tested seem to also error out
image

The SADIE set converted fine, same as the MIT and SCUT KEMAR sets.

@kcat
Copy link
Owner

kcat commented Aug 6, 2024

I was going to see whether the latest artifact that fixed issues from #1027 can handle the SOFA variant of the IRCam sets, from the SOFAcoustics database (particularly interested in Listen's IRC_1037). Unfortunately though, MakeMHR reports of an unsupported format. The problem also exhibits in other IRCam sets. image This doesn't happen with IRC_1037 taken from v0.6 of the SOFA database.

This should be reported to libmysofa. mysofa_load is failing to open the file and reporting MYSOFA_INVALID_FORMAT, so there's nothing makemhr can do with it.

Going on to see whether the SOFAs of other sets are also affected from SOFAcoustics' latest DB, I tested RIEC's, FHK's, and the SADIE set. RIEC fails with this constant error (according to ThreeDeeJay, it could be related to this: #779) image These FHK sets that I've tested seem to also error out image

These are a result of pretty much the same issue. MHR files need HRTF responses in a uniform layout, starting at the top with a single response (+90 degrees), and going down in a fixed step with each elevation also having a fixed step between responses as it goes around (starting at 0 degrees, directly in front). makemhr can look for a subset of responses that fit a uniform layout, skipping ones that don't fit, and beyond that, it can synthesize a few of the lower elevations by blending and filtering the lowest available if necessary. But if it can't find a fitting uniform subset of responses, it can't create an mhr file from it.

This is something I want to fix/improve, by spatially resampling the dataset to create a uniform set of responses from a non-uniform set. However, spatial resampling isn't an easy task, especially with a non-uniform source; given a desired point, you need to find the necessary nearby points and blend factors to create a phantom response at the desired point. For makemhr, this would be best done in the frequency magnitude domain (after calculating the delay onsets, and performing the FFT to getting the magnitude of each frequency band, tossing out the phase which gets reconstructed later) so that the responses can be blended without destructive phase interference. Unfortunately libmysofa doesn't seem to have a method to calculate the indices and blending weights for makemhr to do its own blending of the magnitude data.

Blending responses on top of blended responses has a tendency to create muddied or muffled sound, if destructive phase interference isn't accounted for. Since OpenAL Soft does interpolate them in real-time for extra spatial precision, or via ambisonic panning over a set of responses, that extra blending can have a noticeable negative effect on the result, if not done carefully.

@the-byte-bender
Copy link

Hello,
I'm having a related issue. I don't have any experience in how hrtf actually works, so excuse my ignorance.
I've downloaded a file from https://sofacoustics.org/data/database/ari. Trying to convert it to mhr. It exits with code 127. I'm on windows. Here is how I use the tool:

$ ./makemhr.exe -i "hrtf b_nh2.sofa" -o test.mhr
Using 2 threads.
Reading HRTF data from hrtf b_nh2.sofa...
Detecting compatible layout...
Non-uniform elevations on field distance 1.200.
Got: -25.00, -20.00, +0.00, +20.00, +25.00, +55.00, +60.00, +70.00, +80.00
Using 0 of 1550 IRs.

Then it just exits with code 127 without printing anything else. Am I doing something wrong?

@ThreeDeeJay
Copy link
Contributor

@the-byte-bender
Why you're getting that error: #903 (comment)
What you can do about it: #903 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants