Skip to content

Commit

Permalink
playing.pl now has test code to go through a matched tune and pull ou…
Browse files Browse the repository at this point in the history
…t all the notes.
  • Loading branch information
LastOfTheCarelessMen committed Dec 27, 2009
1 parent d84f024 commit 0aaec06
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions playing.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@
g>ecg ec e/f/g/e/ | d/c/B/A/ Gd BG B/c/d/B/ | 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 :|»; 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> / @notes.map({.say});
{
say $<ABC::note>.perl;
}

0 comments on commit 0aaec06

Please sign in to comment.