312 Commits

Author SHA1 Message Date
Chris Robinson
d732a8831e Update the UHJ decoding coefficients 2021-03-24 00:24:10 -07:00
Chris Robinson
ae43e628fb Add support for decoding 3- and 4-channel UHJ audio
There are no known file formats intended to support 3- and 4-channel UHJ, but
it is possible to store them in various audio files when a player/decoder is
aware of what it's dealing with. So there's no reason not to have it as an
option.
2021-03-21 19:37:24 -07:00
Chris Robinson
b8ede345f3 Don't assume two input channels in uhjdecoder 2021-03-21 12:36:56 -07:00
Chris Robinson
c3ee678945 Add a utility to decode UHJ sound files to AMB
Currently only supports 2-channel UHJ, and the produced .amb files shouldn't be
played as normal B-Format (decoded 2-channel UHJ needs to use different shelf
filters).
2021-03-21 02:03:45 -07:00
Chris Robinson
302e88dbf0 Add missing include 2021-02-16 05:42:14 -08:00
Chris Robinson
417d8da6f4 Avoid a deprecated function 2020-11-13 21:47:48 -08:00
Chris Robinson
af9c990277 Print the number of used measurements in sofa-info 2020-10-07 01:04:42 -07:00
Chris Robinson
02e51c0525 Avoid using a deprecated function 2020-08-31 17:48:26 -07: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
7ddd49e16a Add the jack/connect-ports option to alsoft-config 2020-08-05 00:43:08 -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
Chris Robinson
8ea7d5183b Print the synthesized elevations' azimuth counts 2020-06-16 17:33:26 -07:00
Chris Robinson
94105409f8 Print why a sofa file couldn't be opened 2020-05-21 13:51:48 -07:00
Chris Robinson
3a5a9e90d0 Fix installing alsoft-config 2020-04-15 00:09:45 -07:00
Chris Robinson
8ef8b5e215 Combine utility target installs 2020-04-14 23:37:48 -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
192b1a1f65 Require Qt5 for alsoft-config 2020-04-05 01:41:36 -07: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
1a4a3764d1 Update built-in HRTF name for alsoft-config 2019-11-29 14:54:29 -08:00
Chris Robinson
c093728ced Move the polyphase resampler to the common lib 2019-11-28 10:54:47 -08:00
Chris Robinson
f2eab3e919 Properly get the AppData path on Windows in alsoft-config 2019-11-20 14:22:04 -08:00
Chris Robinson
74cbba511d Limit HRTF ambisonic decoding to second-order
The generated third-order matrix has incorrect first-order coefficients,
indicating a wonky decoder. The generated second-order matrix looks more
stable.
2019-11-09 13:04:44 -08:00
Chris Robinson
205ff0080e Adjust padding in alsoft-config and remove an invalid signal 2019-10-27 18:02:25 -07: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
882b4acae8 Add "fast" variants for the bsinc resamplers
This simply omits the scale factor from the filter, similar to how up-sampling
does. The consequence of this is less smooth transitions when ramping the
pitch while down-sampling, but otherwise behaves fine.
2019-09-28 01:58:29 -07:00