55 Commits

Author SHA1 Message Date
Chris Robinson
302e88dbf0 Add missing include 2021-02-16 05:42:14 -08:00
Chris Robinson
2fa842a04c Avoid allocating for each HRIR reconstruction 2020-08-14 18:22:20 -07:00
Chris Robinson
aafcb1f6fc Simplify StrSubst in makemhr 2020-08-13 16:02:13 -07:00
Chris Robinson
fd52c828a9 Improve handling main() with UTF-8 args on Windows 2020-08-12 17:40:00 -07:00
Chris Robinson
a0eb532100 Apply simulated HRIR occlusion in the frequency domain 2020-06-21 19:28:37 -07:00
Chris Robinson
24393ab192 Synthesize missing elevations in the frequency domain
This should help avoid destructive phase interference. The occlusion low-pass
filter is still applied in the time domain due to no clear topology (cutoff
frequency, slope, bandwidth, etc).
2020-06-21 00:29:57 -07:00
Chris Robinson
a01dbeb09f Use multiple threads for magnitude calculations
Also allow user-declarable thread count.
2020-06-19 16:43:09 -07:00
Chris Robinson
8780976979 Avoid blending multiple IRs for the -90 elevation IR 2020-06-19 15:28:22 -07:00
Chris Robinson
4cd0e333c8 Calculate the HRIR onsets and magnitudes separately from loading
This should help improve memory use a bit since the SOFA file can be unloaded
before allocating some temp buffers for onset detection and FFT calculation.
2020-06-17 17:15:26 -07:00
Chris Robinson
3f26ce4a82 Add a makemhr option to use the farthest field only
All fields are used for equalization, but only the farthest field is resampled,
reconstructed, normalized, and written to the mhr.
2020-06-17 16:25:40 -07:00
Chris Robinson
beba71a6f9 Resample HRIRs after equalization 2020-06-17 13:03:26 -07:00
Chris Robinson
4cfd63a1c7 Avoid reinitializing the resampler with each HRIR 2020-06-17 01:50:11 -07:00
Chris Robinson
cd6bb65d49 Resample HRTFs in the frequency domain in makemhr
This should produce far better results given it works directly on the frequency
response magnitudes prior to phase reconstruction, as it doesn't deal with a
linear phase filter on a truncated time-domain response (with the result also
getting truncated in both direction).

The in-library on-load HRTF resampler still uses the linear filter due to its
relative performance and simplicity benefits. It's good enough as a backup,
though users with custom HRTFs would benefit from resampling when creating the
mhr (adjusting its window size as appropriate/desired).
2020-06-17 01:15:01 -07:00
ArthurSonzogni
7548c235bd Add missing <cstdarg>
OpenAL-Soft fails to compile on some GCC version:
https://travis-ci.com/github/ArthurSonzogni/smk/jobs/318304162

It has regressed likely after:
c83609277b

va_start is defined in:
- <stdarg.h>
- <cstdarg>

The repository is using it from:
- al/error.cpp
- al/filter.cpp
- alc/alu.cpp
- alc/helpers.cpp
- common/alexcpt.cpp
- utils/makemhr/loaddef.cpp
- utils/openal-info.c

This patch is adding its definition in the files missing it:
- common/alexcpt.cpp
- utils/makemhr/loaddef.cpp
- utils/openal-info.c

Bug: https://travis-ci.com/github/ArthurSonzogni/smk/jobs/318304162
2020-04-10 23:36:19 +02:00
Chris Robinson
be89684f3c Update the makemhr utility and default HRTF 2020-02-11 01:01:10 -08:00
Chris Robinson
3acc667c28 Scale delays when exceeding the max for generated mhr files 2020-02-10 22:25:07 -08:00
Chris Robinson
f63880c2ff Use the peak IR magnitude to get the onset
While maybe not technically correct, we actually only care about the difference
between onsets (any base constant is removed). This should work better since it
determines when the IR is most audible, whereas previously it used a variable
threshold of when it reached 15% of the max amplitude.

An even better method may be to check where the IR amplitude exceeds a fixed
threshold (i.e. the same threshold applied to all IRs), but that would need
tweaking to find a level that doesn't catch random noise and doesn't
potentially miss the more occluded IRs.
2020-01-25 16:59:07 -08:00
Chris Robinson
7d0c01050a Fix MHR limits 2019-12-11 01:20:00 -08:00
Chris Robinson
4867f93a34 Move duplicate SOFA-related functions to a reusable library 2019-12-11 00:49:57 -08:00
Chris Robinson
ae916929c9 Simplify a status-checking loop 2019-12-10 20:11:11 -08:00
Chris Robinson
47f416efaf Simplify a couple assignments 2019-12-09 23:11:16 -08:00
Chris Robinson
f4b3c3b4da Simplify a check 2019-12-08 19:23:16 -08:00
Chris Robinson
7ded42cb94 Load SOFA HRIRs in a background thread 2019-12-08 19:17:58 -08:00
Chris Robinson
5942974d47 Report the non-uniform elevations in sofa-info 2019-12-08 17:56:56 -08:00
Chris Robinson
8076fd8aa9 Report the number of IRs used from SOFA files 2019-12-08 17:01:34 -08:00
Chris Robinson
8cb0e0a58b Simplify some parameters 2019-12-08 13:37:42 -08:00
Chris Robinson
1dc26f305a Improve detection of compatible layouts in SOFA files 2019-12-08 03:36:27 -08:00
Chris Robinson
c093728ced Move the polyphase resampler to the common lib 2019-11-28 10:54:47 -08:00
Chris Robinson
0dfdebdf6d Limit the number of azimuths and elevations used in SOFA files 2019-10-22 16:30:07 -07:00
Chris Robinson
4733fc6f1e Fix azimuth limit 2019-10-22 15:23:17 -07:00
Chris Robinson
a8a3acb6f6 More consistently use doubles in makemhr and loadsofa 2019-10-22 15:22:37 -07:00
Chris Robinson
fcde56e1fc Increase the max elevation and azimuth count for HRTFs 2019-10-21 11:30:39 -07:00
Chris Robinson
e01b32f8e0 Use istream for makemhr input 2019-09-23 18:37:36 -07:00
Chris Robinson
6d93b2ba81 Use our case-insensitive compare functions in makemhr 2019-09-16 14:55:52 -07:00
Chris Robinson
807d3b64ca Enable and fix more warnings 2019-09-14 18:35:23 -07:00
Chris Robinson
4c76f32dda Avoid implicit conversions with the examples and utils 2019-09-12 03:22:34 -07:00
Chris Robinson
be0442c620 Avoid C-style casts in C++ 2019-09-11 06:47:56 -07:00
Chris Robinson
e4b15aeefc Fix some implicit casts 2019-09-11 04:55:54 -07:00
Chris Robinson
e0a795d9d2 Clean up some more headers 2019-07-28 14:55:02 -07:00
Chris Robinson
b728cf7bd6 Properly include getopt.h 2019-07-14 04:05:08 -07:00
Penguin
313549c76d
Add missing header. 2019-07-14 18:03:32 +09:00
Chris Robinson
363e2fb73a MSVC doesn't like parenthesized type initialization 2019-07-13 16:51:19 -07:00
Chris Robinson
e7bfe1ebd0 Simplify applying the field magnitude factor 2019-03-27 11:52:35 -07:00
Chris Robinson
608e4e916e Avoid recreating temporary buffers all the time 2019-03-26 17:01:45 -07:00
Chris Robinson
2960d729ef Fix a return type for accumulation 2019-03-26 13:47:24 -07:00
Chris Robinson
8b0c9fcf30 Require IR dimensions from a SOFA file 2019-03-26 13:45:25 -07:00
Chris Robinson
2446ee0cca Avoid some explicit loops 2019-03-26 12:37:52 -07:00
Chris Robinson
a5b442b1a4 Add a missing include for varargs 2019-03-26 11:37:28 -07:00
Chris Robinson
0a4d1c858e Support loading SOFA files directly with makemhr
This extracts the definition info it can from the SOFA, and uses the same logic
as sofa-info to automatically detect an appropriate layout. There is a bit of
code duplication from loaddef.cpp and sofa-info.cpp, though there are slight
modifications.
2019-03-25 20:16:02 -07:00
Chris Robinson
cb02bb00be Detect SOFA files for makemhr input 2019-03-25 13:01:44 -07:00