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

Spectrum fails with odd frame sizes, Uncaught WASM error #84

Open
2 of 9 tasks
jmarcosfer opened this issue Dec 26, 2021 · 1 comment
Open
2 of 9 tasks

Spectrum fails with odd frame sizes, Uncaught WASM error #84

jmarcosfer opened this issue Dec 26, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@jmarcosfer
Copy link
Collaborator

What is the issue about?

  • Bug
  • Feature request
  • Usage question
  • Documentation
  • Contributing / Development

What part(s) of Essentia.js is involved?

  • essentia.js-core (vanilla algorithms)
  • essentia.js-model (machine learning algorithms)
  • essentia.js-plot (plotting utility module)
  • essentia.js-extractor (typical algorithm combinations utility)

Description

Any odd frame size for the Spectrum algorithm produces an uncaught WASM error. Neither the Essentia.js documentation nor the upstream docs mention that frame size should be even or a power of two.

Steps to reproduce / Code snippets / Screenshots

	const frames = self.essentia.FrameGenerator(msg.data.audio, frameSize, frameSize*0.5);
	for (let i = 0; i < frames.size(); i++) {
		const audioVector = frames.get(i);
		const windowedFrame = self.essentia.Windowing(audioVector, true, frameSize).frame;
		const spectrum = self.essentia.Spectrum(windowedFrame, frameSize).spectrum;
		const mfccs = self.essentia.MFCC(spectrum, 2, 11000, spectrum.size()).mfcc;
		corpusArray.push({
			id: corpusSizeCount,
			frame: self.essentia.vectorToArray(audioVector),
			analysis: self.essentia.vectorToArray(mfccs)
		});
		corpusSizeCount++;
	}

For odd frame sizes, this produces the following error on the dev console:
Captura de pantalla 2021-12-26 a las 11 42 36

System info

Hardware: MacBook Pro 15 inch 2018, 16GB RAM, 2,2 GHz Intel Core i7 6 cores
OS: macOS Catalina 10.15.7
Platform: Chrome 96.0.4664.110
Library version: Essentia.js 0.1.3

@jmarcosfer jmarcosfer added the bug Something isn't working label Dec 26, 2021
@pnocera
Copy link

pnocera commented Dec 6, 2023

Did you get a workaround for this ? I'm facing the same issue.

Edit : it doesn't break with a frame of size 2048. In this case the spectrum size is 1025 and the mfcc gets calculated.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants