MarkGotham / When-in-Rome

meta-corpus of and code library for the functional harmonic analysis of music
58 stars 12 forks source link

Remote paths for scores #65

Closed MarkGotham closed 1 year ago

MarkGotham commented 1 year ago

Support option for parsing score from remote path. Reasons:

MarkGotham commented 1 year ago

Store suggested remote path in score.txt

MarkGotham commented 1 year ago

Apply immediately as solution to missing scores for Beethoven Piano Sonatas. Later, consider expanding to other corpora.

MarkGotham commented 1 year ago

Where a local score.mxl files exists, perhaps still include the score.txt for source information (i.e., again, URL pointing to the source, and possibly more info).

MarkGotham commented 1 year ago

Remote sores would mean tinkering with the music21 environment settings. Here's a draft that gets the job done but also leaves the place as we found it. Anyone (e.g., @jacobtylerwalls) more familiar with this and spot any issues?

urlPath = 'https://raw.githubusercontent.com/user/repo/file.mxl'
autoDownloadSettingAtStart = environment.Environment()['autoDownload']  # Get current setting
environment.set('autoDownload', 'allow')  # Change current setting
score = converter.parse(urlPath)  # And do anything with it
environment.set('autoDownload', autoDownloadSettingAtStart)  # Restore settings as they were
jacobtylerwalls commented 1 year ago

I think the documented interface is the UserSettings class, but I don't know why, exactly.

giamic commented 1 year ago

Or, we might use curl for download a local copy of the score and store it in the folder with the "score.mxl" name. The advantage is that we do it only once; the disadvantage is that we don't automatically get updates from the original repo.

MarkGotham commented 1 year ago

Thanks both.

I guess I'm mostly thinking that it's unwise to tinker with users' environment settings, especially as that functionality would probably be tucked deeply into other functions. We can alert with warnings and the like, of course, but still ...

@giamic, does curl address that concern?

Perhaps it's best to leave it with the music21 error message, or one of our own like "To use this function you need to set your environment settings" (with how to instructions).

MarkGotham commented 1 year ago

Reminded myself that I've considered this for musescore files before: https://github.com/MarkGotham/When-in-Rome/blob/97e91852e00b5bcbdf1bd88d00a111d6141e284f/Code/updates_and_checks.py#L299-L303

MarkGotham commented 1 year ago

Apply immediately as solution to missing scores for Beethoven Piano Sonatas. Later, consider expanding to other corpora.

So, again this ^.

giamic commented 1 year ago

Curl is just a way to download the file locally. Once that is done, no other changes are needed. So basically we bypass the problem of remote scores on m21

MarkGotham commented 1 year ago

Which version of the Beethoven sonatas? Perhaps this one from @craigsapp?

Am I right in thinking:

  1. @napulen, this is what you used in Augmentednet?
  2. @craigsapp, you approved that use in Augmentednet? You and @napulen discussed this then as I recall but I don't see a licence on the repo.

Further questions for @craigsapp

Thanks all. Grateful for your views and aiming not to step on any toes!

napulen commented 1 year ago

Just to clarify on 1. I ended up using the scores by user ClassicMan (which should be the ones available in other MIR repositories?)

I was originally intending to use the ones by @craigsapp but, after running a note-by-note comparison, I noticed that the transcriptions used for the BPS dataset were probably closer to the scores by ClassicMan, so it lead to a lower risk of misalignment to use those scores.

MarkGotham commented 1 year ago

Just to clarify on 1. I ended up using the scores by user ClassicMan (which should be the ones available in other MIR repositories?)

Thanks @napulen. Can you clarify where and what the licence is?

napulen commented 1 year ago

These are all files without an explicit license (assumed all rights reserved). I reached out to the author privately and received permission to use them for training the network.

MarkGotham commented 1 year ago

Thanks all.

FYI @giamic , @napulen, this is now done for krn scores:

Not for:

Feedback (always) welcome. Thanks again.