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

JS interface for algorithms that expects non-supported I/O types in Embind #27

Open
albincorreya opened this issue May 28, 2020 · 2 comments
Labels
algorithms wishlist bug Something isn't working types related to JS-CPP type conversion

Comments

@albincorreya
Copy link
Member

albincorreya commented May 28, 2020

Issue

The current JS bindings of Essentia WASM backend which generated using Emscripten Embind doesn't provide a factory template to map STL data types such as std::complex (see this issue)(vector_complex) and custom datatypes used in Essentia such as TNT::Array*(matrix_real)

The following algorithms expect either an input, parameter, or output variable of std::complex type.

['CartesianToPolar', 'PolarToCartesian', 'Magnitude', 'ConstantQ', 'NSGConstantQ', 'NSGIConstantQ', 'FFT', 'IFFT', 'FFTC', 'IFFTC', 'HarmonicMask', 'HarmonicModelAnal', 'SineModelAnal', 'SineModelSynth']

The following algorithms expect either an input, parameter, or output variable of TNT::Array* type.

['BpmHistogram', 'FadeDetection', 'HumDetector', 'Onsets', 'Panning', 'SBic', 'SingleGaussian']

There was a bug in the python code generator which included these algorithms in the current builds. All the above-listed algorithms will be excluded from the future essentia.js API until this issue was addressed and solved.

Currently, the most straight-forward way to use these algorithms in JS end will be to cross-compile a custom-written Essentia CPP extractor which abstracts these types with common JS supported data types such as JS object using emscripten::val.

In addition, the following algorithms expect a vector_stereosample type for either input or output variables.

['FalseStereoDetector', 'LoudnessEBUR128', 'StereoDemuxer', 'StereoMuxer', 'StereoTrimmer'].

OR

We could write some generic custom CPP wrappers which could expose a JS interface to these algorithms. Which requires a bit of work.

@jmarcosfer
Copy link
Collaborator

related issue on emscripten repo

@jmarcosfer
Copy link
Collaborator

Also possible newer methods to re-write current conversion function arrayToVector:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
algorithms wishlist bug Something isn't working types related to JS-CPP type conversion
Projects
None yet
Development

No branches or pull requests

2 participants