Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pae2xml
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kainhofer
pae2xml
Commits
cc2b7951
Commit
cc2b7951
authored
15 years ago
by
Reinhold Kainhofer
Browse files
Options
Downloads
Patches
Plain Diff
Implement proper beaming
parent
900e8313
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pae2xml.pl
+29
-11
29 additions, 11 deletions
pae2xml.pl
sample_files/Beams.pae
+7
-0
7 additions, 0 deletions
sample_files/Beams.pae
with
36 additions
and
11 deletions
pae2xml.pl
+
29
−
11
View file @
cc2b7951
...
...
@@ -62,6 +62,7 @@ $divisions = 960;
$old_duration
=
$divisions
;
$old_type
=
"";
$old_octave
=
4
;
$BEAM
=
0
;
# Store all alterations already used in the current measure, so that e.g.
# xCC also detects the second note as a Cis! Needs to be reset at the
...
...
@@ -244,7 +245,6 @@ sub parse_notes {
}
$notes
=~
s/!([^!]*)!(f*)/repeat($1, length($2)+1)/gs
e
;
# write out repetitions
$notes
=~
s/\{([^\}]*)\}/$1/gs
;
# ignore beamings
while
(
$notes
=~
s/(:?\/+:?|^)([^\/:]*)(:?\/+:?)i(:?\/+:?)/$1$2$3$2$4/gs
)
{};
# replace whole-measure repeats (i notation)
$notes
=~
s/(\d+)\(([^;]+\))/\($1$2/gs
;
# pull note lengths into fermatas or triplets
...
...
@@ -265,6 +265,12 @@ sub parse_notes {
}
elsif
(
$notes
=~
/^r(.*)$/
)
{
# End grace
$notes
=
$
1
;
$qq
=
0
;
}
elsif
(
$notes
=~
/^{(.*)$/
)
{
# Begin beam
$notes
=
$
1
;
$BEAM
=
1
;
# Beam endings are handled by the last note of the beam, since
# we need to know for the last note that the <beam>end</beam> tag
# should be used!
}
elsif
(
$notes
=~
/^\=(\d*)(\/.*)$/
)
{
# multi-measure rests
$measrest
=
$
1
;
$notes
=
$
2
;
...
...
@@ -300,16 +306,16 @@ sub parse_notes {
}
}
}
} elsif ($notes =~ /^((\^)?(g|q)?(\,|
\'
)*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?)(.*)$/) { # a note
} 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
} 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
} 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;
$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
>
...
...
@@ -327,10 +333,10 @@ 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
} 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;
$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;
...
...
@@ -340,7 +346,7 @@ sub parse_notes {
<
actual
-
notes
>
'
.$act_notes.
'
</
actual
-
notes
>
<
normal
-
notes
>
1
</
normal
-
notes
>
</
time
-
modification
>
'
, $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);
#print "$note / $tuplet\n";
parse_note($note, $keysig,
''
,
'
<
time
-
modification
>
...
...
@@ -440,7 +446,7 @@ sub parse_notes {
</
note
>
'
;
}
elsif ($notes =~ s/(\d+\.*)\(((g|q)?(\,|
\'
)*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?)\)/\($1$2\)/gs) { # pull duration into fermata parentheses
elsif ($notes =~ s/(\d+\.*)\(((g|q)?(\,|
\'
)*(x|xx|b|bb|n)?\d*\.*(\-|A|B|C|D|E|F|G)t?\+?
}?
)\)/\($1$2\)/gs) { # pull duration into fermata parentheses
# print "after replacement: $notes\n"; exit;
}
elsif ($notes =~ /^ +(.*)$/) {
...
...
@@ -474,8 +480,8 @@ sub parse_note {
$fermata = 1;
}
$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);
$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
, $beamend
) = ($1, $2, $3, $5, $6, $7, $8, $9, $10
, $11
);
print OUT
'
<
note
>
'
;
...
...
@@ -534,8 +540,20 @@ sub parse_note {
# If we have an explicit accidental on the note, print the <accidental> tag
print OUT accidental_explicit ($acc);
# addition is typically empty or a time-modification tag
print OUT $addition;
# print out beaming information if needed:
if ($BEAM == 1) {
print OUT " <beam>begin</beam>\n";
$BEAM = 2;
} elsif (($BEAM > 0) && ($beamend eq "}")) {
print OUT " <beam>end</beam>\n";
$BEAM = 0;
} elsif ($BEAM > 0) {
print OUT " <beam>continue</beam>\n";
}
my $notationbracket = $fermata || $tienotation || ($trill eq "t") || ($notation ne "");
if ($notationbracket) {
print OUT " <notations>\n";
...
...
This diff is collapsed.
Click to expand it.
sample_files/Beams.pae
0 → 100644
+
7
−
0
View file @
cc2b7951
Test Composer
Test case for beams
1.1.1: S beams
plain&easy: %G-2@4/4$bBEA {''6E'B8G}{GA}-''C{'3B8..G}//
Test Library
00000000
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment