Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hrtf = SOFAload('hrtf_M_hrtf B.sofa'); warning: Invalid UTF-8 byte sequences have been replaced. #76

Open
PacoH opened this issue Jul 3, 2023 · 13 comments

Comments

@PacoH
Copy link

PacoH commented Jul 3, 2023

What needs to be done to get this to work?

SOFAstart;
hrtf = SOFAload('hrtf_M_hrtf B.sofa');
warning: Invalid UTF-8 byte sequences have been replaced.
warning: implicit conversion from numeric to char
warning: called from
    SOFAload at line 133 column 9

'NETCDFload' undefined near line 128, column 128a
error: called from
    SOFAload at line 133 column 9

hrtf_M_hrtf B.sofa is in SOFAtoolbox upper level directory.

@petibub
Copy link
Member

petibub commented Jul 3, 2023

could you provide the sofa file (to reproduce your issue)?

@PacoH
Copy link
Author

PacoH commented Jul 3, 2023

Sure. Thanks for your reply. I'm not sure if it is just a path problem. I am new to Octave. The upper SOFAtoolbox directory has been added to the path and hrtf_M_hrtf B.sofa is in that directory:

Screenshot 2023-07-03 at 11 25 03 AM w=600 px

hrtf_M_hrtf B.zip

@isfmiho
Copy link
Collaborator

isfmiho commented Jul 4, 2023

I could not reproduce the issue with Matlab.

Octave returns some warnings though, regarding invalid UTF-8 byte sequences similar to yours. No error though.

I'm wondering if SOFAstart runs properly, it does not return a version number. Which version of SOFA Toolbox do you use?

@isfmiho
Copy link
Collaborator

isfmiho commented Jul 4, 2023

Why do you use these very old SOFA files, SOFA version 0.6? They are deprecated for almost 10 years.

Can you please try to get the latest version from:
https://www.sofaconventions.org/mediawiki/index.php/Files
(ARI database -> hrtf_nh2.sofa)

@PacoH
Copy link
Author

PacoH commented Jul 4, 2023

I'm wondering if SOFAstart runs properly, it does not return a version number. Which version of SOFA Toolbox do you use?

Is it supposed to return a version number? If so that is not mentioned or demonstrated in the documentation. Maybe it only does that in Matlab?

Installed from SOFA Toolbox for Matlab and Octave 2.1.4.zip. Is there a way to get the version number from within Octave. Is there a list of commands available for this toolbox? BTW, the Octave documentation does not mention toolboxes, only packages, which seems peculiar.

@PacoH
Copy link
Author

PacoH commented Jul 4, 2023

Why do you use these very old SOFA files, SOFA version 0.6? They are deprecated for almost 10 years.

Can you please try to get the latest version from: https://www.sofaconventions.org/mediawiki/index.php/Files (ARI database -> hrtf_nh2.sofa)

The reason I am using these SOFA files is because they are all I was able to find in the sparse documentation of the sofalizer ffmpeg filter.

sofalizer - FFmpeg

[FFmpeg-cvslog] doc/filters: add sofalizer examples

SOFAlize This! Downmixing multi-channel audio to stereo – Code Wanderer

I have no way of knowing what SOFA version they are since there are thousands of SOFA files available but I have yet to find a single one that is documented. Hence my interest in this toolbox. I need to identify SOFA files that would work for me. The toolbox page states, "SOFA Toolbox 2.x implements SOFA versions 2.x," but I couldn't find any that were identified as such.

>> hrtf=SOFAload('hrtf_nh2.sofa');
warning: implicit conversion from numeric to char
warning: called from
    SOFAload at line 133 column 9

'NETCDFload' undefined near line 128, column 128
error: called from
    SOFAload at line 133 column 9

Same error.

@petibub
Copy link
Member

petibub commented Jul 4, 2023

When I do that in Octave 8.2.0 on Windows, I get:

SOFAstart
SOFA Toolbox for Matlab/Octave 2.1.4. Copyright: Acoustics Research Institute.
This API implements SOFA version 2.1.
Available SOFA Conventions: FreeFieldDirectivityTF, FreeFieldHRIR, FreeFieldHRTF, General, GeneralFIR, GeneralFIR
-E, GeneralSOS, GeneralString, GeneralTF, GeneralTF-E, SimpleFreeFieldHRIR, SimpleFreeFieldHRSOS, SimpleFreeField
HRTF, SimpleFreeFieldSOS, SimpleHeadphoneIR, SingleRoomMIMOSRIR, SingleRoomSRIR
SOFAdbPath (local HRTF database): C:\ISF\AMT\alle branches\thirdparty\sofa\data\SOFA
SOFAdbURL (internet repository): http://www.sofacoustics.org/data
>> hrtf = SOFAload('hrtf_M_hrtf B.sofa');
warning: Invalid UTF-8 byte sequences have been replaced.
warning: Invalid UTF-8 byte sequences have been replaced.
warning: called from
    SOFAload at line 128 column 17

warning: Invalid UTF-8 byte sequences have been replaced.
warning: called from
    SOFAgetConventions at line 118 column 61
    SOFAload at line 152 column 21

When ignoring the warnings, the load seems to succeed. Interesting is that I do see the version of the Toolbox - as Michael mentioned, it would be good to see why you don't see the version.

@PacoH
Copy link
Author

PacoH commented Jul 4, 2023

Well there may be a difference in the Windows version and the Matlab version of Octave compared to the Macos version. But in any case there is no error.

When ignoring the warnings, the load seems to succeed.

Succeed how? Did you try SOFAinfo(hrtf);?

This is what I get:

>> SOFAstart;
>> hrtf = SOFAload('hrtf_M_hrtf B.sofa');
warning: implicit conversion from numeric to char
warning: called from
    SOFAload at line 133 column 9

'NETCDFload' undefined near line 128, column 128a
error: called from
    SOFAload at line 133 column 9
>> SOFAinfo(hrtf);
error: 'hrtf' undefined near line 1, column 1

What do you get with the SOFA file that isfmiho recommended?:

hrtf_nh2.zip

@isfmiho
Copy link
Collaborator

isfmiho commented Jul 5, 2023

Unfortunately I have no experience with Octave in MacOS.
SOFAgetVersion will also show the version number.

Can you please try to:

  • get the latest version of SOFA Toolbox (2.1.4)
  • run SOFAstart and SOFAgetVersion (make sure you have the proper version)
  • get the latest version of that SOFA file that you are using

@PacoH
Copy link
Author

PacoH commented Jul 5, 2023

>> SOFAstart;
>> SOFAgetVersion
ans = 2.1.4

So that works.

@petibub
Copy link
Member

petibub commented Jul 5, 2023

When thinking about the cause of your problem (which we cannot reproduce), one thought: Why can you do SOFAstart; and the load an HRTF which is NOT in the same directory as SOFAstart without changing the directory. Do you have some paths added to the search path of Octave - which might explain the irreproducible behavior?

If yes, remove all SOFA related paths, restart Octave, check again if there are no SOFA-related paths, go to the directory with SOFAstart, call SOFAstart, then you MUST change the directory to that one with your HRTFs, and there you call hrtf=SOFAload(..);.

I wonder if you'll get the error then...

@isfmiho
Copy link
Collaborator

isfmiho commented Sep 26, 2023

When thinking about the cause of your problem (which we cannot reproduce), one thought: Why can you do SOFAstart; and the load an HRTF which is NOT in the same directory as SOFAstart without changing the directory. Do you have some paths added to the search path of Octave - which might explain the irreproducible behavior?

If yes, remove all SOFA related paths, restart Octave, check again if there are no SOFA-related paths, go to the directory with SOFAstart, call SOFAstart, then you MUST change the directory to that one with your HRTFs, and there you call hrtf=SOFAload(..);.

I wonder if you'll get the error then...

@PacoH: Did petibub's suggestions help? Is the issue solved?

@PacoH
Copy link
Author

PacoH commented Sep 26, 2023

Thanks isfmiho. I will try this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants