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

Float params accept JS string containing numeric characters #137

Open
jmarcosfer opened this issue Mar 6, 2024 · 0 comments
Open

Float params accept JS string containing numeric characters #137

jmarcosfer opened this issue Mar 6, 2024 · 0 comments
Assignees
Labels
bug Something isn't working EMSCRIPTEN tests

Comments

@jmarcosfer
Copy link
Collaborator

For reference when designing the tests in #66, and related to types like #27.

During manual testing of FrequencyBands I've found the following behaviour regarding its parameter types:

  • Passing it a JS String for its frequencyBands parameter (which expects a VectorFloat in C++) does NOT produce an error, as would be expected. This is after converting the given frequencyBands array to a VectorFloat through the existing utility function arrayToVector, which means the function can successfully copy a JS String into a C++ VectorFloat. The result of the conversion for a 5-letter String is a vector of 5 NaNs. Essentia then does not complain about this VectorFloat of NaNs.
  • Passing it a JS String for its float-typed sampleRate parameter produces an error only if the String contains text characters. However, it does not fail with a String containing numeric characters (such as "16000", instead of the JS Number of 16000). This means there is probably some sort of string->number type casting attempted somewhere in Embind, but I couldn't find any verification (checked here, here, here, here, and here).

I've opened a discussion on Emscripten's GitHub repository.

@jmarcosfer jmarcosfer added bug Something isn't working EMSCRIPTEN tests labels Mar 6, 2024
@jmarcosfer jmarcosfer self-assigned this Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working EMSCRIPTEN tests
Projects
None yet
Development

No branches or pull requests

1 participant