sofacoustics / SOFAtoolbox

SOFA Toolbox (API for Matlab, Octave)
http://sofaconventions.org
European Union Public License 1.2
116 stars 31 forks source link

Load and Save .sofa files automaticly changes .sofa file ability to be recognized as a valid by steam Audio (Unity) #43

Closed Vasco-Rosa closed 2 years ago

Vasco-Rosa commented 2 years ago

I need to create a HRIR that doesn't change the signal, but in the process of creating I ran into this problem:

When I load a .sofa file (from MIT) with SOFAload function and then save it again with SOFAsave the information that is there changes (regardless of level of compression I choose) - I can see by the size of the new file, and because Unity (specifically Steam Audio) can't read it, while before it could.

In attachment there is the original .sofa file from MIT and the file after being read and saved using the API (Matlab_edit sofa file). There is also a print of the code (which is pretty basic).

issue.zip

isfmiho commented 2 years ago

I reproduced the code that you posted. The newly created file can be loaded without any issues. Yes, the file changes depending on the version of the SOFA API you are using (some version numbers are updated). DateCreated and DateModified are also updated when saving a new file.

The parameter '0' causes no compression which increases the file size significantly.

You can run this commands to compare attributes:

SOFAstart; Obj=SOFAload('hrtfmitkemar.sofa'); SOFAsave('hrtfmitkemar2.sofa',Obj); Obj2=SOFAload('hrtfmitkemar2.sofa'); [TF,REASON,WHERE] = SOFAcompare(Obj, Obj2)