CPJKU / partitura

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

Octave change not supported for clef (*clefGv2) - string compared to int for has_line #367

Closed gg-g closed 1 month ago

gg-g commented 1 month ago

The Humdrum Viewer documentation states that "a vocal tenor clef is represented by *clefGv2, where the v means the music should be played an octave lower than the regular clef’s sounding pitches."

In process_clef_line we have

https://github.com/CPJKU/partitura/blob/76f18c13bfaabb32632d52701d38f322d39e955f/partitura/io/importkern.py#L552-L565

On line 564, the match is extracted but that would be returned as a string, so the comparison on like 565 will always render False.

Maybe by casting it to an int?

clef_line = int(has_line.group(0))

Included kern file fragment test2.krn.txt that triggers this

manoskary commented 1 month ago

Hello and thank you for opening this issue. Effectively not all humdrum clefs are supported in Partitura yet. Kern is a format with a lot of ambiguities and many ways to parse the same information. For our current Kern parser we did a selection of the most common notational elements but we will keep improving it as we go.

We can add support for octave change in the next minor release and you will find the fix ASAP in the develop branch.

Thank you for helping us to improve Partitura and extend its reach!

gg-g commented 1 month ago

Thank you for the swift response and fixes.

I'm dealing with kern since CCARH's kernscores seem to have the largest data repo out there that's widely available, has been used in quite some research and allows for building a somewhat balanced dataset. That's why the recent uptick in kern related issues :)