Skip to content
Snippets Groups Projects
Commit 35f20c4d authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Fix triplets and duplets (the normal-notes value was wrongly set to 1 rather...

Fix triplets and duplets (the normal-notes value was wrongly set to 1 rather than the correct value), fix indentation
parent ea4f36e6
No related branches found
No related tags found
No related merge requests found
...@@ -318,50 +318,33 @@ sub parse_notes { ...@@ -318,50 +318,33 @@ sub parse_notes {
parse_note($note, $keysig, "", "", $qq); 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 } 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); ($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; $triplet =~ /^\(({?(\^)?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?)(.*)\)$/gs;
($note, $triplet) = ($1,$7); ($note, $triplet) = ($1,$7);
#print "$note $triplet\n"; my $time_mod = " <time-modification>
parse_note($note, $keysig, '<tuplet type="start"/>', ' <time-modification>
<actual-notes>3</actual-notes> <actual-notes>3</actual-notes>
<normal-notes>2</normal-notes> <normal-notes>2</normal-notes>
</time-modification>', $qq); </time-modification>\n";
parse_note($note, $keysig, '<tuplet type="start"/>', $time_mod, $qq);
$triplet =~ /^({?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?)(.*)$/gs; $triplet =~ /^({?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?)(.*)$/gs;
($note, $triplet) = ($1,$6); ($note, $triplet) = ($1,$6);
#print "$note $triplet\n"; parse_note($note, $keysig, '', $time_mod, $qq);
parse_note($note, $keysig, '', ' <time-modification> parse_note($triplet, $keysig, '<tuplet type="stop"/>', $time_mod, $qq);
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>', $qq);
parse_note($triplet, $keysig, '<tuplet type="stop"/>', ' <time-modification>
<actual-notes>3</actual-notes>
<normal-notes>2</normal-notes>
</time-modification>', $qq);
} elsif ($notes =~ /^((\d+)\(({?(\^)?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?}?)+\;(\d+)\))(.*)$/) { # an n-tuplet } 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); ($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;
$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);
($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 =
my $act_notes = $numval; my $act_notes = $numval;
parse_note($note, $keysig, '<tuplet type="start"/>', ' <time-modification> my $norm_notes = duration($combdur)/duration($notedur);
<actual-notes>'.$act_notes.'</actual-notes> my $time_mod = " <time-modification>
<normal-notes>1</normal-notes> <actual-notes>$act_notes</actual-notes>
</time-modification>', $qq); <normal-notes>$norm_notes</normal-notes>
</time-modification>\n";
parse_note($note, $keysig, '<tuplet type="start"/>', $time_mod, $qq);
while ($tuplet =~ /^({?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?\}?)([^}]+}?)$/gs) { while ($tuplet =~ /^({?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?\}?)([^}]+}?)$/gs) {
($note, $tuplet) = ($1,$6); ($note, $tuplet) = ($1,$6);
#print "$note / $tuplet\n"; parse_note($note, $keysig, '', $time_mod, $qq);
parse_note($note, $keysig, '', ' <time-modification>
<actual-notes>'.$act_notes.'</actual-notes>
<normal-notes>1</normal-notes>
</time-modification>', $qq);
} }
parse_note($tuplet, $keysig, '<tuplet type="stop"/>', ' <time-modification> parse_note($tuplet, $keysig, '<tuplet type="stop"/>', $time_mod, $qq);
<actual-notes>'.$act_notes.'</actual-notes>
<normal-notes>1</normal-notes>
</time-modification>', $qq);
} elsif ($notes =~ /^(%(\w(-|\+)\d))(.*)$/) { # Clef change } elsif ($notes =~ /^(%(\w(-|\+)\d))(.*)$/) { # Clef change
($clef,$notes) = ($2,$4); ($clef,$notes) = ($2,$4);
print OUT " <attributes>\n"; print OUT " <attributes>\n";
...@@ -597,7 +580,7 @@ sub parse_note { ...@@ -597,7 +580,7 @@ sub parse_note {
'; ';
} }
if ($notation ne "") { if ($notation ne "") {
print OUT " $notation\n"; print OUT " $notation\n";
} }
if ($notationbracket) { if ($notationbracket) {
print OUT " </notations>\n"; print OUT " </notations>\n";
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment