MarkGotham / When-in-Rome

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

Dez #88

Closed giamic closed 1 year ago

giamic commented 1 year ago

Introduce a new converter from Rn directly to Dez. Add a couple of tests

NB: This breaks the tonality because I don't remember how to read all the different tonalities from a score in music21. Let's talk about it.

MarkGotham commented 1 year ago

Thanks @giamic !

When music21 parses rntxt ...

So the way to get changes to either is if this_object.attribute != prev_object.attribute. (This can be by keeping a record go the previous state, or there's actually music21 .previous() functionality for this now.) Debatable whether to do this for chord as it's feasible that an exact repeat would be wanted, but definitely for key changes.

Obviously the key signatures on the part are not it at all.

Happy to chat.

MarkGotham commented 1 year ago

i.e. / e.g.

from music21 import corpus
analysis = corpus.parse("bach/choraleAnalyses/riemenschneider005.rntxt")
rns = analysis.recurse().getElementsByClass(roman.RomanNumeral)
previous_key = "FAKE!"
for rn in rns:
    if rn.key != previous_key:
        previous_key = rn.key
        print(rn.measureNumber, previous_key)
giamic commented 1 year ago

Nice! Thanks for letting me know. Then we should already have everything we need. I will update this PR maybe this Wednesday with the full solution!

giamic commented 1 year ago

I have implemented the change you suggested and it seems to work. I have updated the reference dezrann file to the new one, which has the following differences:

Let me know if it all looks good to you!

MarkGotham commented 1 year ago

Hi @giamic, thanks for this! Some good progress here. I've added a few small/obvious edits and added a quick, direct rn to dez conversion for discussion (no score required).

As I see it, here is the current status:

  1. remove unnecessary intermediate tab state = DONE by you, thanks 👍
  2. remove unnecessary score import = under discussion, sketched by me just now
  3. remove unnecessary wrangling with measure offsets = under discussion, sketched by me just now

Wrt 2./3. the new rn2dez shows how we could get the offsets directly from the analysis, and even directly from the RNs without recourse to the measure (which dez doesn't use anyway). I argue that we should do this because it helps:

What do you think? It could stand alone (apart from the Tab logic here) or else be integrated?