Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matchfile v1.0.0 voice parsing fix #331

Merged
merged 5 commits into from
Oct 23, 2023
Merged

Conversation

huispaty
Copy link
Collaborator

This PR fixes bug #267 for voice parsing from match files of version 1.0 (the most current one) that follow the v+digit(s) pattern

  • Voice info is now parsed as follows: If there is no voice info, all notes get assigned voice number 1. If there is only voice info for the solo voice, the non-solo voiced notes get voice 2. If multiple notes have different voices, but not every note has a voice annotated, those with voice annotation get the annotated voice number and those without voice annotation get assigned the max voice+1 voice number.
  • The unittest now contains an assertion for match voice parsing from v1.0.

@huispaty huispaty requested a review from sildater October 23, 2023 13:21
@huispaty huispaty self-assigned this Oct 23, 2023
partitura/io/importmatch.py Show resolved Hide resolved
if not all([n.voice for n in part.notes_tied]):

n_voices = set([n.voice for n in part.notes])
if len(n_voices) == 1 and None in n_voices:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this only adds voices equal to one in case all voices are None. Maybe something like

n_voices_num = [n.voice for n in part.notes if n is not None]
n_voices_none = [n.voice for n in part.notes if n is None]
new_voice = 0
if len(n_voices_num) > 0:
    new_voice = max(n_voices_num ) + 1
if len(n_voices_num):
     -> the loop

@sildater sildater merged commit 60b04af into develop Oct 23, 2023
@huispaty huispaty deleted the match_voice_parsing_fix branch October 25, 2023 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants