Permalink
Browse files

playing.pl now has test code to go through a matched tune and pull ou…

…t all the notes.
  • Loading branch information...
1 parent d84f024 commit 0aaec06ba32547f66e3a5280af0977f87252fcf9 @LastOfTheCarelessMen committed Dec 27, 2009
Showing with 12 additions and 7 deletions.
  1. +12 −7 playing.pl
View
@@ -14,15 +14,20 @@
g>ecg ec e/f/g/e/ | d/c/B/A/ Gd BG B/c/d/B/ |
g/f/e/d/ c/d/e/f/ gc e/f/g/e/ | dB/A/ gB +trill+A2 +trill+e2 :|»;
-if $abc ~~ m/ <ABC::header> /
+my $match = $abc ~~ m/ <ABC::tune> /;
+
+die "Tune not matched\n" unless $match ~~ Match;
+
+my @notes = gather for $match<ABC::tune><music><line_of_music> -> $line
{
- for $<ABC::header><header_field> -> $line
+ for $line<bar> -> $bar
{
- say "header: {$line<header_field_name>}: {$line<header_field_data>}";
+ for $bar<element>
+ {
+ when .<broken_rhythm> { take .<broken_rhythm><note>[0]; take .<broken_rhythm><note>[1]; }
+ when .<note> { take .<note>; }
+ }
}
}
-if "^^A/3" ~~ m/ <ABC::note> /
-{
- say $<ABC::note>.perl;
-}
+@notes.map({.say});

0 comments on commit 0aaec06

Please sign in to comment.