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.
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:String
for itsfrequencyBands
parameter (which expects aVectorFloat
in C++) does NOT produce an error, as would be expected. This is after converting the givenfrequencyBands
array to aVectorFloat
through the existing utility functionarrayToVector
, which means the function can successfully copy a JSString
into a C++VectorFloat
. The result of the conversion for a 5-letterString
is a vector of 5NaN
s. Essentia then does not complain about thisVectorFloat
ofNaN
s.String
for itsfloat
-typedsampleRate
parameter produces an error only if theString
contains text characters. However, it does not fail with aString
containing numeric characters (such as"16000"
, instead of the JSNumber
of16000
). 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.