330 Commits

Author SHA1 Message Date
Chris Robinson
f8ac1ffe80 Get rid of MathDefs 2022-01-27 02:59:07 -08:00
Chris Robinson
481b115b96 Add an ambi-format option for ACN ordering and FuMa scaling 2022-01-12 03:25:59 -08:00
Chris Robinson
e32c214e9c Use the deprecated enum for older Qt versions 2022-01-06 17:01:26 -08:00
Chris Robinson
16ae002d0b Avoid a deprecated QString enum 2022-01-05 20:39:12 -08:00
Chris Robinson
43ec687ee9 Add a third-order ambisonic decoder for HRTF
Using the 20-channel dodecahedron, seems to be good enough to handle 16-channel
third-order ambisonics.
2022-01-05 20:32:03 -08:00
Chris Robinson
5381527303 Add the PipeWire config option to alsoft-config 2021-12-25 20:30:57 -08:00
Chris Robinson
a73b64ce3c Slight update to the UHJ coefficients
The extended precision of the encoder's 0.6512*X term was guesswork, with no
real basis for it. Switch back to the original value until something better
actually comes up. Also updates the decoder to account for the change in the
encoder.
2021-11-28 05:39:35 -08:00
Chris Robinson
bd254c5426 Recognize PipeWire in alsoft-config 2021-11-26 03:05:05 -08:00
Chris Robinson
3ef4bffaf9 Slightly improve logging on Windows
The characters won't display properly if the system codepage isn't UTF-8, but
at least it shouldn't cut the line off prematurely.
2021-11-21 21:21:46 -08:00
Chris Robinson
5eb93f6c74 Update alsoft-config 2021-11-11 22:40:10 -08:00
Chris Robinson
f963a2c543 Remove some lingering mentions of surround51rear 2021-10-21 07:38:57 -07:00
Chris Robinson
47c20b283e Use a higher quality all-pass for the UHJ utils 2021-07-30 08:08:16 -07:00
Chris Robinson
955fdebcad Add a utility to encode audio files to UHJ 2021-07-09 09:04:07 -07:00
Chris Robinson
f403fbd2e9 Fix UHJ encoding/decoding factors
Classic B-Format uses scaling factors W=1, X=sqrt(2), Y=sqrt(2), and Z=sqrt(2),
which is +3dB louder than FuMa. The base factors are designed assuming classic
scaling, so encoding a 0dBFS FuMa signal without accounting for this would
result in the UHJ signal peaking at about -3dBFS. Similarly, decoding UHJ to
FuMa B-Format would be +3dB louder than intended.

So encoding needs to implicitly boost the signal by +3dB, and decoding needs to
attenuate by -3dB.
2021-04-11 17:09:52 -07:00
Chris Robinson
e32b551944 Remove some unnecessary includes 2021-03-28 06:10:45 -07:00
Chris Robinson
8ab5e5dba2 Move the UHJ phase shifter to a common header 2021-03-28 06:09:11 -07:00
Chris Robinson
f045694ce0 Add an option to change the UHJ decoder method
For 2-channel UHJ, two decoding equations are provided in the original paper.
The alternative one is most often referenced for 2-channel UHJ decoding, but
the original/general one can also be used by assuming T is fully attenuated
(which the format allows for, as T can be variably attenuated by a factor
between 0 and 1 to deal with an imperfect transmission medium).

Neither method can be perfect for 2-channel UHJ, it's irrevocably lossy to the
original source, but my subjective testing indicates the general equation
produces less audibly errant results.
2021-03-26 02:55:45 -07:00
Chris Robinson
d681573803 Fix a comment typo 2021-03-24 04:34:01 -07:00
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