sofacoustics / SOFAtoolbox

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

MIT-Conversion fails #35

Closed fewege closed 2 years ago

fewege commented 2 years ago

I'm using the "SOFAconvertMIT2SOFA" function to render a sofa object from the "full" folder with the IR saved in wav-files. This works fine with the original "full folder" of the MIT but if I'm inserting my own IR into the folder structure I'm getting error messages. Those differ slightly from case to case.

Case 1: I replaced some IRs of the ones of the MIT with my own IRs (different length but same format, bit depth and sample rate).

Error Message:

Unable to perform assignment because the size of the left side is 1-by-1-by-449615 and the size of the right side is 1-by-512.

Error in SOFAconvertMIT2SOFA (line 49) Obj.Data.IR(ii,idx(1),:) = audioread(fn)'; % data.IR must be [M R N]

Case 2: I used just my own measured IRs. Those are the same files like in Case 1.

Error Message:

Error using audioread>readaudio (line 143) The filename specified was not found in the MATLAB path.

Error in audioread (line 136) [y, Fs] = readaudio (filename, range, datatype);

Error in SOFAconvertMIT2SOFA (line 49) Obj.Data.IR(ii,idx(1),:) = audioread(fn)'; % data.IR must be [M R N]

Annotation: I used the right labeling of the files. The files of the MIT and mine are just differing in size and IR information and I don't see that the API is "interested" in the length or the frequency spectrum of my IRs.

It would really help if someone has got an explanation for those errors! Please feel free to ask for more information, if you need any to help me on this.

I'm looking forward to your help!

petibub commented 2 years ago

Dear fewege,

I assume that you refer to the release, v. 1.1.3.

Ad #1: the data size is determined in line 38 of SOFAconvertMIT2SOFA by loading the file [postfix '0e000a.wav'] from the directory [root filesep prefix filesep 'elev0']. Could you check what file is being loaded in your case? I guess that this file has the size of 512 and thus the procedure in line 49 fails.

Ad #2: "The filename specified was not found in the MATLAB path." means that audioread(fn) can't find the file with the name fn. In line 49, fn is [root filesep prefix filesep 'elev' num2str(ele) filesep postfix num2str(ele) 'e' sprintf('%03d',round(flip_azi)) 'a.wav'] and corresponding file must be found by the system. Could you check if fn is actually available - for all for-loop iterations?

In any case, you could just load your wav files into a matrix Data.IR which needs to be Mx2xN with M the number of HRTF positions and N the number of filter taps. That's more or less the main job the converter does...

Hope that help, Piotr

isfmiho commented 2 years ago

Dear fewege,

can you provide test files (wav), and a script to reproduce the issue?