Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Copy file.

  • Loading branch information...
commit 7e4ae770b181d823d9d2216a5adb879f0afdcc68 1 parent a326b88
LastOfTheCarelessMen authored
Showing with 36 additions and 0 deletions.
  1. +36 −0 dg-check.pl
36 dg-check.pl
View
@@ -0,0 +1,36 @@
+use v6;
+
+BEGIN { push @*INC, "lib" }
+use ABC;
+
+my $abc = q«X:64
+T:Cuckold Come Out o' the Amrey
+S:Northumbrian Minstrelsy
+M:4/4
+L:1/8
+K:D
+A/B/c/A/ +trill+c>d e>deg | GG +trill+B>c d/B/A/G/ B/c/d/B/ |
+A/B/c/A/ c>d e>deg | dB/A/ gB +trill+A2 +trill+e2 ::
+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 :|»;
+
+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 $line<bar> -> $bar
+ {
+ for $bar<element>
+ {
+ when .<broken_rhythm> { take .<broken_rhythm><note>[0]; take .<broken_rhythm><note>[1]; }
+ when .<note> { take .<note>; }
+ }
+ }
+}
+
+my %header = header_hash($match<ABC::tune><header>);
+my %key_signature = key_signature(%header<K>);
+
+@notes.map({say .<pitch> ~ " => " ~ apply_key_signature(%key_signature, .<pitch>)});
Please sign in to comment.
Something went wrong with that request. Please try again.