CPJKU / partitura

A python package for handling modern staff notation of music
https://partitura.readthedocs.io
Apache License 2.0
223 stars 16 forks source link

Measure number -> measure index #311

Open fosfrancesco opened 1 year ago

fosfrancesco commented 1 year ago

Measures have 2 attributes:

The proposal is to change "number" to "index" to avoid confusion. This will also impact some functions, like measure_number_map.

huispaty commented 12 months ago

(added here just for completeness): Currently, the number attribute represents a running count of measures (tags), irrespective of their regularity or volta endings - thus it starts at 1 and continuously increments. If we want to interpret it more like an index, the renaming would make sense. I'm flexible with either option, feel free to choose.

neosatrapahereje commented 11 months ago

I think that we could introduce the index as a separate attribute and not as a substitution of number. Originally, number was based on the MusicXML specification (as @huispaty points out), and measure number 0 is used for pickup measures. I think we should not loose this property, as it reflects an important aspect of the musical syntax.

fosfrancesco commented 11 months ago

I agree with that, but that is what "name" is for (and it is a string since the user can potentially decide to put other stuff inside, even if it is usually just an integer). I don't think "number" starts from 0 for pickup measures right now.

huispaty commented 11 months ago

It's true, currently number represents something more akin to a count as opposed to a number, and starts at 1, and name exists to handle non-integer measures (i.e. marking irregular or pickup measures).

manoskary commented 8 months ago

After the DLfM 2023 article on Measures, I think a good representation of measure class could contain three attributes:

Should we implement it in Partitura this way?

huispaty commented 8 months ago

As we had just discussed I think their way of representing (and particularly identifying) measures would help us in clarifying the confusion between the current name and number attributes. So I'm fine with you implementing it that way.

sildater commented 1 month ago

Hello! So picking up on this thread, I checked a couple of files, and it seems like the Measure class includes name and number properties since version 1.3 with number always starting at 1 and being an integer and name being catch-all for the rest. As for the IO functions:

There seem to be several inconsistencies introduced by this change. My proposal is to find a clear agreement on what the fields number and name represent (-> an put a short explainer in discussions) and everyone then fixes "their" created functions. I didn't check any output functions, but I expect a similarly mixed picture.

fosfrancesco commented 1 month ago

Good point! I second this proposal