From 35f20c4d00c565e6a8ecc3daa3cb0e0a609c100d Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Mon, 19 Jul 2010 19:35:37 +0200 Subject: [PATCH] Fix triplets and duplets (the normal-notes value was wrongly set to 1 rather than the correct value), fix indentation --- pae2xml.pl | 49 ++++++++++++++++-------------------------------- sample_files/Tuplets.pae | 7 +++++++ 2 files changed, 23 insertions(+), 33 deletions(-) create mode 100644 sample_files/Tuplets.pae diff --git a/pae2xml.pl b/pae2xml.pl index c99c0aa..bc79762 100755 --- a/pae2xml.pl +++ b/pae2xml.pl @@ -318,50 +318,33 @@ sub parse_notes { parse_note($note, $keysig, "", "", $qq); } elsif ($notes =~ /^(\(({?(\^)?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?){3}\))(.*)$/) { # a triplet ($triplet, $notes) = ($1,$8); - # print "TRIPLET: ".$triplet." -> "; $triplet =~ /^\(({?(\^)?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?)(.*)\)$/gs; ($note, $triplet) = ($1,$7); - #print "$note $triplet\n"; - parse_note($note, $keysig, '', ' + my $time_mod = " 3 2 - ', $qq); + \n"; + parse_note($note, $keysig, '', $time_mod, $qq); $triplet =~ /^({?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?)(.*)$/gs; ($note, $triplet) = ($1,$6); - #print "$note $triplet\n"; - parse_note($note, $keysig, '', ' - 3 - 2 - ', $qq); - parse_note($triplet, $keysig, '', ' - 3 - 2 - ', $qq); + parse_note($note, $keysig, '', $time_mod, $qq); + parse_note($triplet, $keysig, '', $time_mod, $qq); } elsif ($notes =~ /^((\d+)\(({?(\^)?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?)+\;(\d+)\))(.*)$/) { # an n-tuplet ($tuplet, $notes) = ($1,$10); - # print "N-TUPLET: ".$tuplet." -> "; - $tuplet =~ /^(\d+)\(({?(\,|\')*(x|xx|b|bb|n)?\d*\.*(g|q)?(\-|A|B|C|D|E|F|G)t?\+?}?)(.*);(\d)\)$/gs; - ($combdur, $note, $tuplet, $numval) = ($1,$2,$7,$8); - #print "i=$combdur, n=$numval; $note / $tuplet\n"; - my $ind_dur = duration($combdur)/$numval; - # my $norm_notes = + $tuplet =~ /^(\d+)\(({?(\,|\')*(x|xx|b|bb|n)?(\d*\.*)(g|q)?(\-|A|B|C|D|E|F|G)t?\+?}?)(.*);(\d)\)$/gs; + ($combdur, $note, $notedur, $tuplet, $numval) = ($1,$2,$5, $8,$9); my $act_notes = $numval; - parse_note($note, $keysig, '', ' - '.$act_notes.' - 1 - ', $qq); + my $norm_notes = duration($combdur)/duration($notedur); + my $time_mod = " + $act_notes + $norm_notes + \n"; + parse_note($note, $keysig, '', $time_mod, $qq); while ($tuplet =~ /^({?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?\}?)([^}]+}?)$/gs) { ($note, $tuplet) = ($1,$6); - #print "$note / $tuplet\n"; - parse_note($note, $keysig, '', ' - '.$act_notes.' - 1 - ', $qq); + parse_note($note, $keysig, '', $time_mod, $qq); } - parse_note($tuplet, $keysig, '', ' - '.$act_notes.' - 1 - ', $qq); + parse_note($tuplet, $keysig, '', $time_mod, $qq); } elsif ($notes =~ /^(%(\w(-|\+)\d))(.*)$/) { # Clef change ($clef,$notes) = ($2,$4); print OUT " \n"; @@ -597,7 +580,7 @@ sub parse_note { '; } if ($notation ne "") { - print OUT " $notation\n"; + print OUT " $notation\n"; } if ($notationbracket) { print OUT " \n"; diff --git a/sample_files/Tuplets.pae b/sample_files/Tuplets.pae new file mode 100644 index 0000000..96fb4c1 --- /dev/null +++ b/sample_files/Tuplets.pae @@ -0,0 +1,7 @@ +Test Composer +Test case for tuplets +1.1.1: S tuplets +plain&easy: %G-2@c$ΓΌ '1C/4C4('6DEFGA;5)2C/8C8({'3DEFGA};5)4C2-/8-8(6ABC;3)8-8({6ABC};3)8-(6ABC)8-({6ABC})/1C// + +Test Library +00000000 \ No newline at end of file -- 2.11.4.GIT