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
645 stars 42 forks source link

EssentiaTFInputExtractor.audioBufferToMonoSignal throws TypeError #57

Closed jmarcosfer closed 3 years ago

jmarcosfer commented 3 years ago

Problem

When using EssentiaTFInputExtractor.audioBufferToMonoSignal with a stereo audio file the following exception is thrown:

Uncaught (in promise) TypeError: vect.size is not a function
    at Object.Module.vectorToArray (essentia-wasm.web.js:27)
    at EssentiaTFInputExtractor.vectorToArray (essentia.js-model.js:154)
    at EssentiaTFInputExtractor.audioBufferToMonoSignal (essentia.js-model.js:201)
    at EssentiaTFInputExtractor.downsampleAudioBuffer (essentia.js-model.js:218)

Suggested Solution

I believe this happens because vectorToArray is receiving a JS object (returned by the MonoMixer algorithm inside of it) instead of the VectorFloat it expects. As per documentation, this VectorFloat is in the audio property of the returned object.