From 1aef0747092c5170eab7bb89dee4ea1687c4e92d Mon Sep 17 00:00:00 2001 From: huispaty Date: Sun, 8 Oct 2023 16:35:22 +0200 Subject: [PATCH 1/4] fix match voice parsing bug --- partitura/io/importmatch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/partitura/io/importmatch.py b/partitura/io/importmatch.py index 04e96f8f..29b24438 100644 --- a/partitura/io/importmatch.py +++ b/partitura/io/importmatch.py @@ -619,8 +619,8 @@ def part_from_matchfile( # no staff attribute, or staff attribute does not end with a number note_attributes["staff"] = None - if "s" in note.ScoreAttributesList: - note_attributes["voice"] = 1 + if "v" in note.ScoreAttributesList[0]: + note_attributes["voice"] = note.ScoreAttributesList[0].split("v")[-1] else: note_attributes["voice"] = next( (int(a) for a in note.ScoreAttributesList if number_pattern.match(a)), From 739ef721bd564f1d0f0af1c45d6b61b9493ca365 Mon Sep 17 00:00:00 2001 From: huispaty Date: Wed, 11 Oct 2023 10:19:12 +0200 Subject: [PATCH 2/4] second fix for voice parsing --- partitura/io/importmatch.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/partitura/io/importmatch.py b/partitura/io/importmatch.py index 29b24438..d131c625 100644 --- a/partitura/io/importmatch.py +++ b/partitura/io/importmatch.py @@ -618,14 +618,15 @@ def part_from_matchfile( except (TypeError, ValueError): # no staff attribute, or staff attribute does not end with a number note_attributes["staff"] = None - - if "v" in note.ScoreAttributesList[0]: - note_attributes["voice"] = note.ScoreAttributesList[0].split("v")[-1] - else: - note_attributes["voice"] = next( - (int(a) for a in note.ScoreAttributesList if number_pattern.match(a)), - None, - ) + + # @CC: Is there a reason for this (aka should it stay)? I checked some older datasets (vienna, magaloff, zeilinger) but they either don't have voice info or have voice info following the v+int pattern + # if "s" in note.ScoreAttributesList: + # note_attributes["voice"] = 1 + # else: + note_attributes["voice"] = next( + (int(a[1:]) for a in note.ScoreAttributesList if number_pattern.match(a)), + None, + ) # get rid of this if as soon as we have a way to iterate over the # duration components. For now we have to treat the cases simple From 35a5d03b5e81bcfc29c33b9dd48a2f87b73b3b0c Mon Sep 17 00:00:00 2001 From: huispaty Date: Wed, 11 Oct 2023 13:41:59 +0200 Subject: [PATCH 3/4] rebased match_import branch --- partitura/io/importmatch.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/partitura/io/importmatch.py b/partitura/io/importmatch.py index d131c625..c06f344b 100644 --- a/partitura/io/importmatch.py +++ b/partitura/io/importmatch.py @@ -619,14 +619,13 @@ def part_from_matchfile( # no staff attribute, or staff attribute does not end with a number note_attributes["staff"] = None - # @CC: Is there a reason for this (aka should it stay)? I checked some older datasets (vienna, magaloff, zeilinger) but they either don't have voice info or have voice info following the v+int pattern - # if "s" in note.ScoreAttributesList: - # note_attributes["voice"] = 1 - # else: - note_attributes["voice"] = next( - (int(a[1:]) for a in note.ScoreAttributesList if number_pattern.match(a)), - None, - ) + if "s" in note.ScoreAttributesList: + note_attributes["voice"] = 1 + else: + note_attributes["voice"] = next( + (int(a[1:]) for a in note.ScoreAttributesList if number_pattern.match(a)), + None, + ) # get rid of this if as soon as we have a way to iterate over the # duration components. For now we have to treat the cases simple From a06f43fde00653cb37c1f53ea85e1149f52aec30 Mon Sep 17 00:00:00 2001 From: Emmanouil Karystinaios Date: Fri, 13 Oct 2023 17:08:13 +0200 Subject: [PATCH 4/4] Update importmatch.py Removed a space to launch tests. No code edit was made. --- partitura/io/importmatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/partitura/io/importmatch.py b/partitura/io/importmatch.py index c06f344b..6bb47bf8 100644 --- a/partitura/io/importmatch.py +++ b/partitura/io/importmatch.py @@ -619,7 +619,7 @@ def part_from_matchfile( # no staff attribute, or staff attribute does not end with a number note_attributes["staff"] = None - if "s" in note.ScoreAttributesList: + if "s" in note.ScoreAttributesList: note_attributes["voice"] = 1 else: note_attributes["voice"] = next(