re4_tweaks icon indicating copy to clipboard operation
re4_tweaks copied to clipboard

X3DAudio1_7_HRTF support

Open emoose opened this issue 2 years ago • 11 comments

Haven't seen this mentioned anywhere else, but seems https://github.com/kosumosu/x3daudio1_7_hrtf works with RE4 - compiled the latest commit of that (need to edit the DirectX-SDK-June-2010.props files with path to DX9 SDK), copied the compiled x3daudio1_7.dll to Bin32 folder, and with the *.mhr files from hrtf\KEMAR folder placed at hrtf\ next to BIO4\ folder, it should start up & work fine.

(if mhr files aren't placed at correct folder then DLL will cause an exception and show a non-helpful "runtime asked to exit" error, might be why PCGW currently lists RE4 as incompatible with it)

I'm not that great at telling how well the 3D audio is working there though, but seems to be fine for me, no obvious issues with it when I tried it out at least.

The log file the HRTF dll creates mentions that HRTF is missing datasets for certain sample rates though, 12000Hz, 18000Hz & 28000Hz were mentioned in my quick testing, would probably work even better if there was some way to create datasets for them (or maybe convert the audio to a different sample-rate that HRTF supports?)

E: ah seems it's not too hard to create custom MHR files, that PCGW page has a guide for it in the OpenAL Soft section.

Unfortunately the OpenAL-Soft tool for creating them has a lower-limit of 32000Hz built into it tho, but apparently others have been able to just edit the limit in the code for that tool & built MHR files with lower rates fine... I've asked on OpenAL-Soft's github page about it.

E2: Ah well it was a good thing I asked, seems it's likely HRTF wouldn't be as effective at lower sample rates like those. Ideally the x3daudio hook would resample audio first before applying HRTF to it, but doesn't look like it has any support for that. Unfortunately it hasn't been updated in over 3 years now, so not sure how much chance there'd be of adding that in :(

Second best option would be resampling the audio files themselves, assuming nothing is hardcoded in the EXE it should be possible I think, not sure if there's much info about modding RE4's audio files though, will try looking into it some more.

emoose avatar Nov 29 '21 08:11 emoose