Open blakekrammes opened 3 months ago
When we wrote this, we wanted a way to keep the models versioned and we wanted to additionally serve the model from either a CDN or backend service. We advise you consciously make the decision on which model you want to use and include it yourself. You can find a version of the model in this repo.
Thanks for the quick response. The file you linked to is what I'm trying to initialize the class with. Is there any way to import that model from the node module as is done for the class itself?
import { BasicPitch } from '@spotify/basic-pitch';
So would you recommend just copying the model file to a folder in my application code? I was concerned that if updates were made to it I would have to manually update my application as well. I was hoping I could keep it in sync with the node module itself.
What I did is copy both https://raw.githubusercontent.com/spotify/basic-pitch-ts/main/model/model.json
and https://raw.githubusercontent.com/spotify/basic-pitch-ts/main/model/group1-shard1of1.bin
to my public folder and initialize like this:
new BasicPitch(`${baseUrl}model.json`);
I plan to check for updates to those files periodically, but I know nothing has changed because we're not dependent on any other server at runtime.
Thanks, Paul.
What is the 2nd file? ../group1-shard1of1.bin
.
Also, I'm a fan of abc.js; I used it in a personal project a few years ago. I guess the JS music world isn't too large.
Thanks for the links @paulrosen . If anything changes in a way that would cause a break with basic-pitch-ts, we'd release a new major version. But generally, it's probably good practice not to trust all updates to a model. Sometimes a new version of a model could work worse for tasks it previously worked well with even if there's an overall improvement.
I'm trying to use Basic Pitch in my Next.js application and struggling to read the model.json file required to initialize the class. Why is the model not baked into the initializer? Why is the model not importable from the Basic Pitch module? Maybe I'm missing something obvious.
Thanks!