MTG / essentia.js

JavaScript library for music/audio analysis and processing powered by Essentia WebAssembly
https://essentia.upf.edu/essentiajs
GNU Affero General Public License v3.0
628 stars 41 forks source link

MFCC uncaught error: frameSize lower bound #83

Open jmarcosfer opened 2 years ago

jmarcosfer commented 2 years ago

What is the issue about?

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

Description

When computing MFCCs, any frame size equal to or lower than 426 results in an uncaught WASM error.

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 the frame size described above, this produces the following error on the dev console:

Captura de pantalla 2021-12-26 a las 11 35 53

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