hoene / libmysofa

Reader for AES SOFA files to get better HRTFs
Other
131 stars 70 forks source link

Unsupported format error (10001) with Python & h5netcdf created sofa file #46

Open vanne02135 opened 6 years ago

vanne02135 commented 6 years ago

I wonder what's wrong with my HRTF that was created with h5netcdf, as it loads in all ambisonics daw plugins I tested but not with libmysofa? The sofa in question is https://drive.google.com/file/d/1SIslF4sgsI8lAl3Vm3S_QAdwtmfbbqnS/view?usp=sharing

Any ideas?

hoene commented 6 years ago

You can compile libmysofa with the VDEBUG flag to get more information about the kind and location of the error.

vanne02135 commented 6 years ago

It seems that the superblock version is 0 in my sofa and reader expects version 2 or 3.

After correcting for that (using h5py and libver="latest"), I get a bit further:

libmysofa/src/hdf/dataobject.c:874: 00000030 OHDR libmysofa/src/hdf/dataobject.c:772: OHDR message type 10 offset 4B len 2 libmysofa/src/hdf/dataobject.c:772: OHDR message type 2 offset 51 len 12 libmysofa/src/hdf/dataobject.c:772: OHDR message type 21 offset 67 len 12 libmysofa/src/hdf/dataobject.c:772: OHDR message type 0 offset 7D len 42 libmysofa/src/hdf/fractalhead.c:344: 00993289 FRHP libmysofa/src/hdf/fractalhead.c:238: 0099336D FHIB libmysofa/src/hdf/fractalhead.c:279: >> 4 999A44 5 libmysofa/src/hdf/fractalhead.c:39: 00999A44 FHDB libmysofa/src/hdf/fractalhead.c:63: 5 0 1 libmysofa/src/hdf/fractalhead.c:87: 3 0 18 999A5E libmysofa/src/hdf/fractalhead.c:108: FHDB type 3 unsupported values libmysofa/src/hdf/fractalhead.c:344: 00991F38 FRHP libmysofa/src/hdf/fractalhead.c:39: 00998844 FHDB libmysofa/src/hdf/fractalhead.c:63: 4 0 1 libmysofa/src/hdf/fractalhead.c:87: 1 0 17153 99885D libmysofa/src/hdf/fractalhead.c:160: FHDB type 1 unsupported values Error reading file antti_2k17_latest.sofa. Error code: 10001

Any further tips?

hoene commented 6 years ago

As the code says: / TODO: for the following part, the specification is incomplete / The specification is given in https://support.hdfgroup.org/HDF5/doc/H5.format.html

Now, the following steps are required: 1) We need a license for your sofa file (e.g. creative common or BSD) to add the to the libmysofa test files. 2) We need to reverse engineer the common hdf5 implementation 3) Then, libmysofa can be updated accordingly.

vanne02135 commented 6 years ago

Sounds great. You can use the sofa file under Creative Commons Attribution + Non-commercial (BY-NC). Would you prefer the one linked above, the libver='latest' converted (as in version bounding) or both?

hoene commented 6 years ago

the latest is fine...

simonschwaer commented 6 years ago

+1 on this, using h5py 2.7.1 with libver='latest'. Actually, the MATLAB API cannot read this file too, so the problem might be on the creation side?

I also tried to create a SOFA file from Python with netCDF4-python 1.3.2 (compiled against libnetcdf 4.4.0-2 on Ubuntu 16.04). This file works fine in MATLAB, but libmysofa complains about the superblock version (as vanne02135 reported above with h5netcdf).

hoene commented 4 years ago

see https://github.com/hoene/libmysofa/tree/cachetype0

hoene commented 4 years ago

not relevant anymore

mike-meta commented 2 months ago

@hoene Hi, I'm trying to read a SOFA file created by using h5py and using the latest release version of libmysofa as 1.3.2, but it gives me this error here:

libmysofa\src\hdf\dataobject.c:1204: 00000030 OHDR
libmysofa\src\hdf\dataobject.c:1095:  OHDR message type  2 offset     4C len   12
libmysofa\src\hdf\dataobject.c:1095:  OHDR message type 10 offset     62 len    2
libmysofa\src\hdf\dataobject.c:1095:  OHDR message type 21 offset     68 len   12
libmysofa\src\hdf\dataobject.c:1095:  OHDR message type  0 offset     7E len  189
libmysofa\src\hdf\fractalhead.c:546: 20B FRHP
libmysofa\src\hdf\fractalhead.c:433: 00003465 FHIB
libmysofa\src\hdf\fractalhead.c:480: >> 4 68DE0E1 5
libmysofa\src\hdf\fractalhead.c:51: 068DE0E1 FHDB stack 1
libmysofa\src\hdf\fractalhead.c:75:  5 0 1
libmysofa\src\hdf\fractalhead.c:117:  3    0 C 068DE0F7
libmysofa\src\hdf\fractalhead.c:139: FHDB type 3 unsupported valuesFile: 
SOFA decode error: 10001
Failed to read SOFA format.

We thought this issue might be related to endianness of the SOFA file created by h5py but it gives the same error if I use little or big endianness, which seems has nothing to do with this issue. Any hint how to resolve this issue?

umlaeute commented 2 months ago

please provide an example file (preferably small), or (easy to run) code to generate one.

mike-meta commented 2 months ago

please provide an example file (preferably small), or (easy to run) code to generate one.

Hi @umlaeute, thanks for responding. Here is a small test file that fails on my end attached here: https://drive.google.com/file/d/1aJqohf07TefRk2XKmgiR-FbwXjmL89zs/view?usp=sharing. It could be used by you for testing purposes under Creative Commons Attribution + Non-commercial (BY-NC) license. Please let me know there is something I can do to help.

umlaeute commented 2 months ago

thanks. i'm attaching the file here (so as long as the issue tracker works it should be available)

test_h5py.sofa.zip (CC-BY-NC-4.0)

mike-meta commented 2 months ago

@umlaeute Hi, I appreciate your help if you let me know if there is any update on this issue. Thanks!

hoene commented 1 month ago

I had a look on it. It is a bit more complicated as the HDF5 spec is not well documented here - or at least I did not found it. @gheber might help me which the information on how to implement the reader.