Code Monkey home page Code Monkey logo

leomccormack / spatial_audio_framework Goto Github PK

View Code? Open in Web Editor NEW
522.0 28.0 85.0 352.97 MB

A cross-platform framework for developing spatial audio algorithms and software in C/C++

Home Page: https://leomccormack.github.io/Spatial_Audio_Framework/

License: Other

C 98.82% C++ 0.26% Batchfile 0.11% CMake 0.24% MATLAB 0.54% Shell 0.05%
spatial-audio spherical-harmonics vbap ambisonics 3d-audio spatial-audio-framework microphone-array-processing multi-source-tracking sofa-reader

spatial_audio_framework's Introduction

GitHub release (latest by date) GitHub Release Date DOI

About

The Spatial_Audio_Framework (SAF) is an open-source and cross-platform framework for developing spatial audio related algorithms and software in C/C++. Originally intended as a resource for researchers in the field, the framework has gradually grown into a large codebase comprising a number of distinct modules; with each module targeting a specific sub-field of spatial audio, such as: Ambisonics encoding/decoding, spherical array processing, amplitude-panning, HRIR processing, room simulation, etc.. The framework also makes use of highly optimised linear algebra libraries (such as: Intel MKL, Apple Accelerate, OpenBLAS) as well as x86 SIMD intrinsics (SSE, AVX, AVX-512).

Several examples are also included in the repository, which serve to demonstrate the functionality of the framework and may also act as a starting point for new projects. These examples have also been realised as VST/LV2 audio plug-ins under the SPARTA banner.

Owing to its modular design, expanding the framework is relatively straightforward, and contributions from researchers and developers of spatial audio technologies is encouraged! :-)

Prerequisites

The framework requires the following external libraries:

In order to inform SAF which CBLAS/LAPACK supporting library/libraries you have linked to your project, simply add one of the following global pre-processor definitions:

SAF_USE_INTEL_MKL_LP64        # great option, but only for x86 architectures (using the LP64 config [int32])
SAF_USE_INTEL_MKL_ILP64       # great option, but only for x86 architectures (using the ILP64 config [int64])
SAF_USE_OPEN_BLAS_AND_LAPACKE # good option, works on everything
SAF_USE_APPLE_ACCELERATE      # good option (x86 and ARM), faster than OpenBLAS, but MacOSX only & slower than MKL
SAF_USE_ATLAS                 # bad option (x86 and ARM), many LAPACK functions are missing
SAF_USE...                    # please get in touch if you use something else! :-)

Detailed instructions regarding how to build and link these libraries can be found here.

Framework structure

The framework comprises the following core modules (ISC License):

  • saf_hoa - a collection of higher-order Ambisonics binaural and loudspeaker decoders.
  • saf_sh - spherical harmonic and spherical array processing related functions.
  • saf_vbap - Vector-base Amplitude Panning (VBAP) functions.
  • saf_cdf4sap - Covariance Domain Framework for Spatial Audio Processing (CDF4SAP).
  • saf_hrir - HRIR/HRTF related functions (estimating ITDs, HRTF interpolation, diffuse-field EQ etc.).
  • saf_reverb - a collection of reverbs and room simulation algorithms.
  • saf_utilities - a collection of useful utility functions and cross-platform wrappers.

The framework also includes the following optional modules:

  • saf_sofa_reader - a simple SOFA file reader (ISC License).
  • saf_tracker - a particle-filtering based tracker (GPLv2 License).
  • saf_hades - for binaural rendering of Hearing-Assistive/Augmented-reality Devices (HADES) (GPLv2 License).

To enable optional framework modules, simply add the relevant pre-processor definition:

SAF_ENABLE_SOFA_READER_MODULE  # to enable saf_sofa_reader
SAF_ENABLE_TRACKER_MODULE      # to enable saf_tracker
SAF_ENABLE_HADES_MODULE        # to enable saf_hades

Additional options

The framework can be configured further, with the following options:

SAF_USE_INTEL_IPP # To use Intel IPP for performing the DFT/FFT and resampling
SAF_USE_FFTW      # To use the FFTW library for performing the DFT/FFT 
SAF_ENABLE_SIMD   # To enable SIMD (SSE3, AVX2 and/or AVX512) intrinsics for certain vector operations

Using the framework

Once a CBLAS/LAPACK flag is defined (and the correct libraries are linked to your project), add the files found in the framework folder to your project and add the following directory to your project's header search paths:

Spatial_Audio_Framework/framework/include  

The framework's master include header is then:

#include "saf.h"
#include "saf_externals.h"  /* (Optional) To also carry over CBLAS/LAPACK routines and other external functions. */

Building with CMake

CMake Build

The framework may also be included within an existing CMake workflow with simply:

add_subdirectory(Spatial_Audio_Framework)
target_link_libraries(${PROJECT_NAME} PRIVATE saf)

The available SAF-related CMake options (and their default values) are:

-DSAF_PERFORMANCE_LIB=SAF_USE_INTEL_MKL_LP64 # performance library to employ
-DSAF_ENABLE_SOFA_READER_MODULE=0            # enable/disable the saf_sofa_reader module 
-DSAF_ENABLE_TRACKER_MODULE=0                # enable/disable the saf_tracker module 
-DSAF_ENABLE_HADES_MODULE=0                  # enable/disable the saf_hades module 
-DSAF_BUILD_EXAMPLES=1                       # build saf examples
-DSAF_BUILD_EXTRAS=0                         # build safmex etc.
-DSAF_BUILD_TESTS=1                          # build unit testing program
-DSAF_USE_INTEL_IPP=0                        # link and use Intel IPP for the FFT, resampler, etc.
-DSAF_ENABLE_SIMD=0                          # enable/disable SSE3, AVX2, and/or AVX-512 support
-DSAF_ENABLE_NETCDF=0                        # enable the use of NetCDF (requires external libs)
-DSAF_ENABLE_FAST_MATH_FLAG=1                # enable the -ffast-math compiler flag on clang/gcc

If using e.g. SAF_USE_INTEL_MKL_LP64 as the performance library, note that the default header and library search paths may be overridden according to your setup with:

-DINTEL_MKL_HEADER_PATH="path/to/mkl/headers"
-DINTEL_MKL_LIB="path/to/mkl/libs/mkl_rt(.so/.dylib/.lib)"   # OR:
-DINTEL_MKL_LIB="path/to/custom/mkl/lib/saf_mkl_custom_lp64(.so/.dylib/.lib)"

For Linux/MacOS users: the framework, examples, and unit testing program may be built as follows:

# By default:
cmake -S . -B build 
# Or to also enable e.g. SSE3, AVX2, and/or AVX-512 intrinsics (for both C and C++ code):
cmake -S . -B build -DSAF_ENABLE_SIMD=1
# Or to build Universal binaries for macOS (ARM/x86), which must therefore use Apple Accelerate:
cmake -S . -B build -DSAF_PERFORMANCE_LIB=SAF_USE_APPLE_ACCELERATE -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
# Then to build and run the unit testing program:
cd build
make
test/saf_test 

Or for Visual Studio users (using x64 Native Tools Command Prompt for VS):

# e.g. for VS2019:
cmake -S . -B build -G "Visual Studio 16" -A x64  
# e.g. for VS2017:
cmake -S . -B build -G "Visual Studio 15 2017" -DCMAKE_GENERATOR_PLATFORM=x64
# Then to build and run the unit testing program:
cd build
msbuild ALL_BUILD.vcxproj /p:Configuration=Release /m
cd test/Release
saf_test.exe  

Documentation

Doxygen Generate

Doxygen-based documentation is generated via a GitHub Action everytime a commit is pushed to the master branch. The documentation is hosted here.

Alternatively, you may generate the documentation yourself (e.g. for the other branches) with the following commands:

cd docs/doxygen
doxygen doxygen_config
# (optional) to also build the pdf version:
cd latex
make

Examples

Several examples have also been included in the repository, which may serve as a starting point for learning how to use the framework:

  • ambi_bin - a binaural Ambisonic decoder with built-in rotator. It supports the following decoding options: least-squares (LS), spatial re-sampling (SPR), Time-alignment (TA), Magnitude Least-Squares (MagLS).
  • ambi_dec - a frequency-dependent Ambisonic decoder. It supports the following decoding options: sampling Ambisonic decoder (SAD), AllRAD, Energy-Preserving decoder (EPAD), Mode-Matching decoder (MMD).
  • ambi_drc - a frequency-dependent dynamic range compressor (DRC) for Ambisonic signals.
  • ambi_enc - a basic Ambisonic encoder.
  • ambi_roomsim - an Ambisonic encoder that also includes reflections and source distance based on an image-source model of a shoebox room. Multiple sources and Ambisonic receivers are supported.
  • array2sh - converts microphone array signals into spherical harmonic signals (aka Ambisonic signals), based on theoretical descriptions of the array configuration and construction.
  • beamformer - a beamformer/virtual microphone generator for Ambisonic signals, with several different beam pattern options.
  • binauraliser - convolves input audio with interpolated HRTFs, which can be optionally loaded from a SOFA file.
  • binauraliser_nf - binauraliser, with the addition of proximity filtering for near field sound sources.
  • decorrelator - a basic multi-channel signal decorrelator.
  • dirass - a sound-field visualiser based on re-assigning the energy of beamformers. This re-assignment is based on the DoA estimates extracted from spatially-localised active-intensity vectors, which are biased towards each beamformer direction.
  • matrixconv - a basic matrix convolver with an optional partitioned convolution mode.
  • multiconv - a basic multi-channel convolver with an optional partitioned convolution mode.
  • tvconv - a time-varying partitioned convolution multi-channel convolver for SOFA files containing RIRs with multiple listener positions.
  • panner - a frequency-dependent VBAP panner, which accommodates a source loudness compensation (as a function of the room) option.
  • pitch_shifter - a basic multi-channel pitch shifter, based on the phase vocoder approach.
  • powermap - sound-field visualiser based on beamformer (PWD, MVDR) energy or subspace methods (MUSIC).
  • rotator - rotates spherical harmonic signals (aka Ambisonic signals) given yaw-pitch-roll Euler rotation angles.
  • sldoa - a sound-field visualiser based on directly depicting the DoA estimates extracted from multiple spatially-localised active-intensity vectors for multiple frequencies.
  • spreader - an arbitrary array panner (HRIRs, microphone array IRs, etc.) with coherent and incoherent spreading modes.

Many of these examples have also been released as VST audio plug-ins under the SPARTA banner. The following open-source projects also employ the framework: HADES, Super-Hearing, HO-SIRR-GUI, and CroPaC-Binaural.

Extras

The repository also includes the following extras:

  • matlab - a bunch of MATLAB scripts/functions to accompany the framework (a script to generate saf_default_hrirs.c, MATLAB versions of certain SAF functions, etc.).
  • safmex - a bunch of MATLAB MEX wrappers, which allow certain SAF functions to be used within MATLAB.
  • safpy - a bunch of Python wrappers, which allow certain SAF functions to be used within Python.
  • safwwise - a proof of concept regarding how one might integrate SAF into Wwise.

Contributing

Suggestions and contributions to the code are both welcomed and encouraged. It should be highlighted that the framework has been designed to be highly modular with plenty of room for expansion. Therefore:

  • if you are researcher who has developed a spatial-audio related method and want to integrate it into the framework... or
  • if you notice that an existing piece of code can be rewritten to make it clearer, faster, or to fix a bug...

then please feel free to do so and submit a pull request. We may also be able to help with the implementation if needed, just get in touch :- )

Contributors

  • Leo McCormack - C programming and algorithm design (contact: leo.mccormack(at)aalto.fi)
  • Symeon Delikaris-Manias - algorithm design
  • Archontis Politis - algorithm design
  • Ville Pulkki - algorithm design
  • Juhani Paasonen - C programming
  • Chris Hold - C programming and algorithm design
  • Janani Fernandez - C programming and algorithm design

License

This software is dual-licensed. By default, this software is provided permissively under the terms of the ISC License; since all of the core (non-optional) modules are licensed as such. However, including and enabling certain optional modules, which are instead provided under the copy-left GNU GPLv2 License, will mean that the use of this software is instead governed by the GNU GPLv2 licencing terms.

For full licensing terms see LICENSE.md.

Note that, while we do not force any copyleft philosophies onto the permissively licensed modules, we would still appreciate it if improvements and/or bug fixes are also merged into this public repository where possible :-)

spatial_audio_framework's People

Contributors

1enn0 avatar bijulette avatar carmethene avatar chris-hld avatar exargon avatar jananifernandez avatar juhanipaasonen avatar leomccormack avatar liam-strand avatar madskjeldgaard avatar magnus-nomono avatar marclava avatar marcobin avatar mtmccrea avatar nmkahlen avatar olilarkin avatar rapolasd avatar ssaue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spatial_audio_framework's Issues

Building saf_mkl_custom.dll

Hey there!

Thank you and your team so much for this project. It really is so great to have this framework in place.

I've been wanting to incorporate this framework into my node environment using N-API wrapping for the SAF functions. I build these wrappers using the node-gyp tool. So far, I'm able to get the project to build, but am running into errors when I try run the project with the saf_mkl_custom.dll that came with the SPARTA plugins - you can find further info on my issue here #1834. As shown in this issue, when I include the saf_mkl_custom.dll in my node extension, I see that there are some functions in the .dll that are missing, or not referenced correctly and the module is unable to run. The dependency walker confirms this.

image

I'm still trying to figure out if this is a node-gyp issue or an issue with the saf_mkl_custom.dll.

I'm using windows 10. I have installed intel's MKL library and am using Visual Studio 2017 nmake for the .dll compilation.

I've since decided that I should try build the .dll from scratch to see if I can find more information. I've tried to run the command mentioned in the readme. I run this command from the dependencies/win64 directory.

nmake intel64 interface=lp64 threading=sequential name=saf_mkl_custom export=saf_mkl_list

However, I get thrown this error from nmake

Microsoft (R) Program Maintenance Utility Version 14.15.26730.0
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1073: don't know how to make 'intel64'
Stop.

Might you have any idea why this error would be thrown?

Any help would be greatly appreciated :)

Cython wrappers for Python

Hi, what is the current status of the python wrappers for the SAF? Are they available for public distro yet? Thanks in advance!

Regards,
Tim

example with audio file

Hi all,
Can you share for me a example , which process in audio file ( as mp3 , wav, raw)?
Best Regards,
HuongNV

Build instructions do not work

I use plain Ubuntu.

$ cmake -S . -B build
CMake Error: The source directory "/home/df/Spatial_Audio_Framework-master/build" does not exist.
$ cmake --version
cmake version 3.10.2

Buffer overflow in saf_utility_dvf.c

Please replace every line in curly brackets { like this } with appropriate answers, and remove this line.

Description

Trying to track down some mysterious crashes in my app, I tried running the SAF tests with ASAN enabled and it is showing me a buffer overflow in this file, see screenshot

Environment

  1. MacOSX 12
  2. Clang
  3. SAF_USE_APPLE_ACCELERATE, etc. }
  4. Xcode with ASAN

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Build SAF test via Xcode
  2. Enable ASAN (see screenshot)

Screenshot 2022-04-22 at 00 05 09

Screenshot 2022-04-22 at 00 08 17

Custom build script for MKL/IPP failure

Description

The custom build script for Intel MKL and IPP doesn't work properly with Intel oneAPI 2024.0.

Environment

  1. OS: Windows 11
  2. Compiler: MSVC (x64 Native Tools Command Prompt for VS 2019)
  3. SAF performance library being used: SAF_USE_INTEL_MKL
  4. Any optional SAF flags enabled: SAF_USE_INTEL_IPP
  5. Other environment details: Intel oneAPI 2024.0

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Install Intel oneAPI 2024.0.
  2. Run scripts/install-safmkl.bat or scripts/install-safipp.bat.

Expected Output

The scripts should recognize the custom build tools of Intel oneAPI.

Actual Output

It aborted with an error the below.

Intel MKL not installed on this machine. Note that Intel MKL can be freely downloaded from here:
"https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html"

Additional information

I've just solved this issue by editing scripts/install-safmkl.bat and scripts/install-safipp.bat.
I guess the toolkit path has been changed in latest oneAPI (but I didn't checked the older versions).

  • MKL
    • Before: C:\Program Files (x86)\Intel\oneAPI\mkl\latest\tools\builder
    • After: C:\Program Files (x86)\Intel\oneAPI\mkl\latest\share\mkl\tools\builder
  • IPP
    • Before: C:\Program Files (x86)\Intel\oneAPI\ipp\latest\tools
    • After: C:\Program Files (x86)\Intel\oneAPI\ipp\latest\opt\ipp\tools

Few questions about the implementation of VBAP

Hello! I am reading this repos recently and confused by some details:

  1. There is an eye3 matrix in method invertLsMtx3D of saf_vbap.c. If I understood correctly, it's an identity matrix. I wonder why eye3 is neccessary to multiply with tempGroup.

    eye3[i*3+j] = i==j ? 1.0f : 0.0f;

  2. There is a logic that omit Trianges that have an aperture larger than APERTURE_LIMIT_DEG(180) in findLsTriplets. The condition is comparing the return of acosf and aperture_lim (which is pi), However, the return of acosf is always [0,pi].

    if(abc[0]<aperture_lim && abc[1]<aperture_lim && abc[2]<aperture_lim){

Hope you can help me with these confusions, Thanks!

Access violation in `saf_example_ambi_bin` while loading HRTFs from SONICOM dataset

Description

Using a HRTF from the SONICOM HRTF dataset will throw an exception (access violation). This has been tested with multiple HRTFs from the mentioned dataset.

Environment

  1. OS: Windows 11 22H2 (22621.1778)
  2. Compiler: MSVC 14.36.32532
  3. SAF performance library being used: SAF_USE_INTEL_MKL
  4. Any optional SAF flags enabled: SAF_ENABLE_SOFA_READER_MODULE, SAF_ENABLE_EXAMPLES_TESTS
  5. Visual Studio Professional 2022 17.6.2, CMake 3.26.2

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Modify test__saf_example_ambi_bin() in file src/test/test__examples.c to load a SOFA file from the SONICOM dataset:
    // ...
    ambi_bin_create(&hAmbi);
    ambi_bin_setSofaFilePath(hAmbi, "path/to/eg/P0010_Windowed_48kHz.sofa");
    // ...
  2. Build and run saf_test with above environment.

Expected Output

Test should pass.

Actual Output

Access violation in framework/modules/saf_utilities/saf_utility_geometry.c:782 while trying to read faceIdx[k]. faceIdx does not exist because nFaceIdx is 0 here.

Additional information

Call Stack:

[0] saf_test.exe!sphVoronoi
	at ...\framework\modules\saf_utilities\saf_utility_geometry.c(782)
[1] saf_test.exe!getVoronoiWeights
	at ...\framework\modules\saf_utilities\saf_utility_geometry.c(959)
[2] saf_test.exe!ambi_bin_initCodec
	at ...\examples\src\ambi_bin\ambi_bin.c(262)
[3] saf_test.exe!test__saf_example_ambi_bin
	at ...\test\src\test__examples.c(56)
[4] saf_test.exe!main_test
	at ...\test\src\saf_test.c(173)
[5] saf_test.exe!main
	at ...\test\src\saf_test_wrapper.cpp(30)

Add equirectangular view of spherical videos to allow panning of sources on top

Problem to Solve

Hi Leo, could you add an option in ambiENC to load an equirectangular view of spherically encoded videos to allow panning of sources on top of them. This would allow us to create an automation that would move the source as the objects in the video are moving.

Current Workaround

Use a different plugin or blindly place sources for 360 spherical content.

Additional Information

This is an example of how it works in the FB360 plugin but it only supports up to 3rd order.
image

Unable to get the powermap example working

Hello, thank you for making this framework open and available! Sorry for the specific question, but after days of trying I have been unable to get a standalone implementation of the powermap example working.
I made a small C program based on the code available for the SPARTA powermap VST that reads an audio file and generates a series of image files of the audio power maps, but I have not been able to obtain correct results.

In my implementation, I read a chunk of the audio file, call the powermap_analyisis and powermap_getPmap functions with the read data, save the image to a file and then read the next chunk of audio data.

However, the power maps generated are incorrect, and they differ greatly from the results obtained when using the powermap SPARTA VST, but what I find really strange is that, for a given audio file, all the generated maps are identical despite the audio chunk data passed to the powermap_analysis function being very different. Interestingly, the map changes when using a different file, but the maps are always incorrect and identical between different chunks of the same file.

Here's are two examples of incorrectly generated PWD powermaps for different ambisonic sound files of first and third order respectively, where it seems to be repeated twice horizontally:
0000
0000

Lastly, I've noticed that when using the CroPaC LCMV mode it outputs the error:

 ** On entry to CPOSV NEYSafe minimumFULCPOSVX1FullEpsilon parameter number  1 had an illegal value
SAF WARNING: Could not solve the linear equation in utility_cslslv(). Output matrices/vectors have been zeroed.

So I'm inclined to believe there might be something wrong with the data being passed, but I think I'm using all the functions correctly and I'm certain that audio data is being read correctly, so I was wondering if there was any information I was missing on the format of the audio (as I'm using float32 audio samples), or other function calls that need to be in place when doing the powermap analysis.

Thanks!

`double` to `float` conversion warnings in when using SAF in code that already defines `M_PI` as `double`

Description

Using Spatial_Audio_Framework in code that already defines M_PI as double (as is very common, cf. e.g. on Win: ucrt/corecrt_math_defines.h) produces a lot of C4244 warnings.

Environment

  1. OS: Windows 11
  2. Compiler: MSVC
  3. SAF performance library being used: SAF_USE_INTEL_MKL
  4. Any optional SAF flags enabled: SAF_ENABLE_SOFA_READER_MODULE
  5. Other environment details: Visual Studio Professional 2019 (16.11.9)

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Define _USE_MATH_DEFINES macro before including <math.h> in framework/modules/saf_utilities/saf_utilities.h:
...
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string.h>
...

This defines M_PI as a double type.

  1. Build any target, e.g. saf_example_ambi_bin

Actual Output

18 C4244 warnings.

Screenshot 2022-01-25 120627

Support for QuadRegion in VBAP

Problem to Solve

Currently, a Left-Right symmetric loudspeaker geometry may end up in an AllRAD designed decoder without Left-Right symmetry. As far as I understand, this may happen during the VBAP phase, during the triangulation, when 4 loudspeakers, e.g. {L1, L2, R2, R1} happens to be coplanar. In such case, the actual triangulation ends up choosing one of the two triangles configuration, e.g. {L1, L2, R2} and {R1, R2, L1}, and eventually produces a matrix that have lost the Left-Right symmetry.

Current Workaround

The best work-around, so far, is to add a virtual loudspeaker, Z, in such a way that the triangulation of {L1, L2, R2, R1,Z} produces 4 triangles and eventually, to downmix Z onto L1, L2, R2, R1.

Proposed Solution

One possible way forward is to adapt VBAP in a way similar to 6.1.2.3 QuadRegion from ITU-R BS.2127-1, i.e. by allowing quadrilateral to be handled and to create its panning accordingly.

Additional Information

In order to reproduce explicitly the issue, consider for instance an AllRAD design given those 4 side loudspeakers {L1, L2, R2, R1} : {110, 0}, {90, 60}, {-90, 60}, {-110, 0}. Add for instance 3 front loudspeaker to complete the sphere coverage: {30, 0}, {-30,0} and {0,0}. Note also that in that case, adding a 8th loudspeaker in e.g. {180, 30} re-establishes the symmetry of the decoder.

Error building

When trying to execute the script install-safmkl.bat on Windows 11 (Visual Studio 2022) it fails with the following error:

NMAKE : fatal error U1073: don't know how to make 'intel64'

I built SAF without any problems by doing the alternate option of using the stock MKL libraries from the OneAPI, but I was wondering what could be causing this issue?

Missing entry in __Tdesign_degree_100_dirs_deg[5100][2]

Description

As far as I can tell, the table __Tdesign_degree_100_dirs_deg[5100][2] in saf_utility_loudspeaker_presets.c is having only 5099 entries. Most likely, the table will be filled by a {0.0f, 0.0f} entry at the end which may or may not be the intention and eventually produces slightly erroneous AllRAD decoder designs.

Environment

N.A.

Reproducible Steps

N.A

Expected Output

Probably, for __Tdesign_degree_100_dirs_deg[5100][2] to have 5100 explicit entries.

Actual Output

N.A

Additional information

None

bessel_jn does not return expected values

Description

The function bessel_jn (spherical) is described to compute the bessel function of the first kind and its derivative. I would therefore expect the function scipy.special.spherical_jn to return the same values. I have been editing values in test__sh_module.c and added print statements to bessel_jn to see the behavior of bessel_jn, and noticed that the values returned by bessel_jn do not match the theory. One discrepancy is that bessel_jn always outputs a value of j_n[i]=1 for an input of z[i]=0 even for orders above 1, when bessel functions above order 1 have a value a value of j_n[i]=0 when z[i]=0. I'm wondering why there is an if-statement setting j_n to 1 at z of 0 for all orders, and if bessel_jn is intended to match the theory otherwise.

Environment

  1. OS: MacOSX 11.6
  2. Compiler: Making and executing the saf_test executable
  3. SAF performance library being used: SAF_USE_INTEL_MKL
  4. Any optional SAF flags enabled: N/A
  5. Other environment details: CMake

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Add print statements for the arguments of bessel_jn to the beginning of bessel_jn, and of the outputs at the end of bessel_jn
  2. In the function test__sphModalCoeffs in the file test__sh_module.c, set kr to an array of values from 0 to 9 (step of 1) after line 709
  3. Insert this call of sphModalCoeffs at 714:
    sphModalCoeffs(2, kr, 10, ARRAY_CONSTRUCTION_OPEN_DIRECTIONAL, 1.0, FLATTEN2D(b_N_card));
    (can edit the first argument to change the order)

Expected Output

Screen Shot 2022-03-09 at 11 00 37 AM

Actual Output

Screen Shot 2022-03-09 at 11 01 37 AM

Notice that besides the issue of j_n[0] being 1, none of the values match anyways. Curiously, jn[2] (scipy) is equivalent to j_n[1] (saf).

ISM RIR: Incorrect summing of bands?

Description

I may be mistaken, but it looks like the octave band splitting may not be writing the filtered signals out, but rather just copying the input to the output.

In particular, the summing stage of ims_shoebox_renderRIR() sums the input channels for a given band wrk->rir_bands[band][i] into the output buffer &(rir->data[i*(wrk->rir_len_samples)]

        /* Sum */
        for(i=0; i<echogram_abs->nChannels; i++)
            cblas_saxpy(wrk->rir_len_samples, 1.0f, wrk->rir_bands[band][i], 1, &(rir->data[i*(wrk->rir_len_samples)]), 1);

The previous block shows the filtered band channels being stored in the temp variable. I would assume it's this filtered signal, temp that should be summed back into the output.

This may not have been caught because it looks like the ambiRoomSim plugin only uses broadband absorption, and I couldn't find anywhere that ims_shoebox_renderRIRs() was actually called.

Here's the larger block for context
https://github.com/leomccormack/Spatial_Audio_Framework/blob/82e3b75a9e4b9deb098e01416b1e91f6feeafb7f/framework/modules/saf_reverb/saf_reverb_internal.c#L685C3-L709

Thanks!

errors when run 'cmake -S . -B build'

Hi all,

I got errors when run 'cmake -S . -B build' command :

CMake Error at framework/CMakeLists.txt:148 (message):
The specified SAF_PERFORMANCE_LIB is not supported

Can you help me to slove this issue ?
Best Regards,
HuongNV

Trouble Building on Apple Silicon with macOS 14.0

Description

Hello! I am running into an issue building SAF using the configuration below. I get three errors when linking against the Apple math libraries. I've figured out a workaround, but I'm hoping that there is a more idiomatic and elegant solution.

Environment

  1. OS: macOS 14.0
  2. Compiler: AppleClang 15
  3. SAF performance library being used: Apple Accelerate
  4. Any optional SAF flags enabled: none
  5. Other environment details: Also have CMAKE_OSX_ARCHITECTURES="arm64;x86_64"

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Generate build files for SAF with above environment
  2. cd into build and run make

Expected Output

I expect the framework to compile correctly and generate a static library

Actual Output

Clang generates three errors, all related to the isnan and isinf macros. I've pasted a representative error message below.

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/complex:1401:53: error: expected unqualified-id
    if (__x.real() == 0 && (__x.imag() == 0 || std::isnan(__x.imag())))
                                                    ^
/Users/liamstrand/Desktop/Tufts/Senior/cs97/Spatial_Audio_Framework/test/include/resources/unity_internals.h:213:18: note: expanded from macro 'isnan'
#define isnan(n) ((n != n) ? 1 : 0)
                 ^

Additional information

I am able to resolve the issue by deleting the isinf and isnan macro definitions at line 204 of unitiy_internals.h. But I suspect there is really an issue in my configuration, so I am hoping for a little help in discovering the root cause!

UPDATE: Similarly, if I don't build the tests, build succeeds.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.