use v6; use lib '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/ /; die "Tune not matched\n" unless $match ~~ Match; my @notes = gather for $match -> $line { for $line -> $bar { for $bar { when . { take .[0]; take .[1]; } when . { take .; } } } } my %header = header_hash($match
); my %key_signature = key_signature(%header); for @notes { say . ~ " => " ~ apply_key_signature(%key_signature, .); }