leomccormack / Spatial_Audio_Framework

A cross-platform framework for developing spatial audio algorithms and software in C/C++
https://leomccormack.github.io/Spatial_Audio_Framework/
Other
567 stars 91 forks source link

Unable to get the powermap example working #59

Open R3Ngfx opened 1 year ago

R3Ngfx commented 1 year ago

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!

R3Ngfx commented 1 year ago

Update:

After a shot break I was able to get the example running. It turns out my code had two main issues:

However I do still get some errors when using the CROPAC_LCMV and MUSIC algorithms (but not when using MUSIC_LOG).

For posterity, if anyone else needs an example of how the framework can be used to generate individual powermaps, the code for a very minimal example is available in this repository.

leomccormack commented 11 months ago

Hi, apologies for the delayed reply! I'm glad the example is now working for you. However, what kind of errors are you getting with CROPAC_LCMV and MUSIC? Note that MUSIC_LOG, is simply log(pmapDerivedUsedMUSIC), so shouldn't be massively different. And CROPAC_LCMV is quite an experimental (and unfinished) mode, so maybe avoid this one if the results are unexpected.