From 7204890da00cf5a27953a13714fbb66c7d055e1d Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Tue, 18 Nov 2008 22:44:15 +0100 Subject: [PATCH] MusicXML: Make tuplet detection work a bit better with nested tuplets At least the script now detects the correct boundaries for nested tuplets. It does not, however, correctly group the notes. For this, the code needs to be substantially changed... --- scripts/musicxml2ly.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 4a04cb4af8..e2a54008e3 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -603,6 +603,7 @@ def group_tuplets (music_list, events): indices = [] + brackets = {} j = 0 for (ev_chord, tuplet_elt, fraction) in events: @@ -610,10 +611,16 @@ def group_tuplets (music_list, events): if music_list[j] == ev_chord: break j += 1 + nr = tuplet_elt.number if tuplet_elt.type == 'start': - indices.append ((j, None, fraction)) + tuplet_info = [j, None, fraction] + indices.append (tuplet_info) + brackets[nr] = tuplet_info elif tuplet_elt.type == 'stop': - indices[-1] = (indices[-1][0], j, indices[-1][2]) + bracket_info = brackets.get (nr, None) + if bracket_info: + bracket_info[1] = j + del brackets[nr] new_list = [] last = 0 -- 2.39.5