spotify / basic-pitch-ts

A lightweight yet powerful audio-to-MIDI converter with pitch bend detection.
https://basicpitch.io
Apache License 2.0
212 stars 15 forks source link

Usage in a service worker? #19

Open paulrosen opened 2 months ago

paulrosen commented 2 months ago

This library is amazing! However, when it's processing it locks up the UI so animations stop and buttons are not clickable.

I was wondering if I could put this in a service worker and am not sure if that has been done before.

The first problem is that a service worker can't import files and I can't figure out how to have my service worker use files in node_modules. I'm guessing I'll need a build step.

I was wondering if there were already a build option in this library for being able to load it the using a single <script> tag, because I think I'd be able to use that in my service worker. I didn't see that.

So I think I might need to write that, which I'll try to do but I'm not sure if I can.

Also I'm not sure if that will even work since there are two other files that get loaded in (the bin and the json files) and I'm not sure if that will work inside the service worker.

Any pointers you can give while I flail away at this would be appreciated.

Thanks!

drubinstein commented 2 months ago

I think it should work. On basicpitch.io, we have basicpitch run in an async function on file load.

Regarding using it in a Githubissues.

  • Githubissues is a development platform for aggregating issues.