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
Branches
No related tags found
No related merge requests found
......@@ -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, '<tuplet type="start"/>', ' <time-modification>
my $time_mod = " <time-modification>
<actual-notes>3</actual-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;
($note, $triplet) = ($1,$6);
#print "$note $triplet\n";
parse_note($note, $keysig, '', ' <time-modification>
<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);
parse_note($note, $keysig, '', $time_mod, $qq);
parse_note($triplet, $keysig, '<tuplet type="stop"/>', $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, '<tuplet type="start"/>', ' <time-modification>
<actual-notes>'.$act_notes.'</actual-notes>
<normal-notes>1</normal-notes>
</time-modification>', $qq);
my $norm_notes = duration($combdur)/duration($notedur);
my $time_mod = " <time-modification>
<actual-notes>$act_notes</actual-notes>
<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) {
($note, $tuplet) = ($1,$6);
#print "$note / $tuplet\n";
parse_note($note, $keysig, '', ' <time-modification>
<actual-notes>'.$act_notes.'</actual-notes>
<normal-notes>1</normal-notes>
</time-modification>', $qq);
parse_note($note, $keysig, '', $time_mod, $qq);
}
parse_note($tuplet, $keysig, '<tuplet type="stop"/>', ' <time-modification>
<actual-notes>'.$act_notes.'</actual-notes>
<normal-notes>1</normal-notes>
</time-modification>', $qq);
parse_note($tuplet, $keysig, '<tuplet type="stop"/>', $time_mod, $qq);
} elsif ($notes =~ /^(%(\w(-|\+)\d))(.*)$/) { # Clef change
($clef,$notes) = ($2,$4);
print OUT " <attributes>\n";
......@@ -597,7 +580,7 @@ sub parse_note {
';
}
if ($notation ne "") {
print OUT " $notation\n";
print OUT " $notation\n";
}
if ($notationbracket) {
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