Algorithms with vector_real parameter types have these parameters converted to VectorFloat on the TypeScript wrapper using the following code pattern:
let veconsets = new this.module.VectorFloat();
for (var i=0; i<veconsets.size(); i++) {
veconsets.push_back(onsets[i]);
}
This produces an uncaught exception on the WASM side, since VectorFloat is initialized empty by default, so the loop never runs and the parameter is passed to the C++ empty.
The affected algorithms are:
AudioOnsetsMarker
BPF
BeatsLoudness
CubicSpline
FrequencyBands
IIR
NoveltyCurve
RhythmExtractor
SingleBeatLoudness
Slicer
Spline
TempoScaleBands
TempoTap
TriangularBands
Steps to reproduce / Code snippets / Screenshots
Here is a quick browser test of the algorithms FrequencyBands and BPF.
This test also includes a proposed solution using one of these options:
// use the Array -> VectorFloat conversion utility function built into essentia.js
let veconsets = this.module.arrayToVector(onsets);
let veconsets = new this.module.VectorFloat();
let i = 0;
while (veconsets.size() < onsets.length) {
veconsets.push_back(onsets[i]);
i++;
}
This will be addressed and solved in the PR for issue #64, with revised generated code for core_api.ts.
What is the issue about?
What part(s) of Essentia.js is involved?
Description
Algorithms with
vector_real
parameter types have these parameters converted toVectorFloat
on the TypeScript wrapper using the following code pattern:This produces an uncaught exception on the WASM side, since
VectorFloat
is initialized empty by default, so the loop never runs and the parameter is passed to the C++ empty. The affected algorithms are:Steps to reproduce / Code snippets / Screenshots
Here is a quick browser test of the algorithms
FrequencyBands
andBPF
. This test also includes a proposed solution using one of these options:This will be addressed and solved in the PR for issue #64, with revised generated code for
core_api.ts
.System info
Hardware: Dell Inc. Vostro 5490; 8,0 GiB RAM; Intel Core i7-10510U CPU @ 1.80GHz × 8 OS: Ubuntu 22.04.2 LTS, 64-bit Browser: Chrome 115.0.5790.110 (Official Build) (64-bit) essentia.js 0.1.3