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

Implement chords

parent 172a3cc1
No related branches found
No related tags found
No related merge requests found
......@@ -300,17 +300,17 @@ sub parse_notes {
}
}
}
} elsif ($notes =~ /^((g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?)(.*)$/) { # a note
($note, $notes) = ($1,$6);
} elsif ($notes =~ /^((\^)?(g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?)(.*)$/) { # a note
($note, $notes) = ($1,$7);
parse_note($note, $keysig, "", "", $qq);
} elsif ($notes =~ /^(\((g|q)?(\,|\')*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)[t\+]*\)[t\+]*)(.*)$/) { # one note with a fermata
($note, $notes) = ($1,$6);
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,$7);
} 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,$6);
$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>
<actual-notes>3</actual-notes>
......@@ -327,8 +327,8 @@ sub parse_notes {
<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
($tuplet, $notes) = ($1,$9);
} 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);
......@@ -469,8 +469,8 @@ sub parse_note {
$fermata = 1;
}
$note =~ /^(g|q)?((\,|\')*)(x|xx|b|bb|n)?(\d*)(\.*)(\-|A|B|C|D|E|F|G)(t?)(\+?)$/;
my ($gracecue, $oct, $acc, $dur, $dot, $pitch, $trill, $tie) = ($1, $2, $4, $5, $6, $7, $8, $9);
$note =~ /^(\^)?(g|q)?((\,|\')*)(x|xx|b|bb|n)?(\d*)(\.*)(\-|A|B|C|D|E|F|G)(t?)(\+?)$/;
my ($chord, $gracecue, $oct, $acc, $dur, $dot, $pitch, $trill, $tie) = ($1, $2, $3, $5, $6, $7, $8, $9, $10);
print OUT ' <note>
';
......@@ -485,6 +485,9 @@ sub parse_note {
if ($pitch eq "-") {
print OUT " <rest />\n";
} else {
if ($chord eq "^") {
print OUT " <chord/>\n";
}
print OUT ' <pitch>
<step>'.$pitch.'</step>
'.alter($pitch, $acc, $keysig)
......
Test Composer
Test case for chords
1.1.1: S Chords
plain&easy: %G-2@c$ ''2D^'A^xF''C^,G^E//
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