sevagh/freemusicdemixer.com

Out of memory on website issue

Closed this issue ยท 4 comments

Hello,

I've been attempting to try this online tool in order to see how capable it is to demix some of my favourite tracks.
So, I've used an 8.8 MB .mp3 file as input, and the website seems not able to process the result.

I've noticed the dev log keeps stuck on this line:

[WASM/C++ 17:28:32] Getting waveforms from istft
[WASM/C++ 17:28:34] Copying waveforms

And if I take a look at JS console, this message is printed:

Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': Data cannot be cloned, out of memory.
    at https://freemusicdemixer.com/worker.js:25:13

I think I'll have to try running this locally without a web interface so that it can get enough memory to work properly.
Just wanted to let you know, I think UI should handle this error to avoid keep user waiting in vain.

sevagh commented

Great - I know users have been reporting this issue (and I believe it), but I haven't tested on a large enough track.

If you email me the 8.8 MB track (sevagh@protonmail.com), I will use it for local debugging and release a fix.

sevagh commented

I found the issue. It's not exactly a memory issue. The whole C++ demixing module works well, producing the correct result.

The problem is I use Web Workers to pass data between input.js (the main site) and worker.js (which runs the C++ demixing code). The issue is the return 4 tracks (drums, bass, vocals, other) for your input track were too big to fit in the message passed back from worker.js to index.js

This can be fixed by transfering the tracks instead of copying them:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects#transferring_objects_between_threads

I've tested your track locally, confirmed it gave me the same error, and also confirmed that my local fix works. I will make a release soon.

sevagh commented

Fix published and is live on the website: ef248ac

Can you retest and close the issue if it's fixed?

Fix published and is live on the website: ef248ac

Can you retest and close the issue if it's fixed?

Hi, just tried it and it's now working, at least on Chrome.
Thanks for your quick fix!