Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 37 lines (29 sloc) 0.961 kb
7e4ae770 »
2010-01-06 Copy file.
1 use v6;
2
3 BEGIN { push @*INC, "lib" }
4 use ABC;
5
6 my $abc = q«X:64
7 T:Cuckold Come Out o' the Amrey
8 S:Northumbrian Minstrelsy
9 M:4/4
10 L:1/8
11 K:D
12 A/B/c/A/ +trill+c>d e>deg | GG +trill+B>c d/B/A/G/ B/c/d/B/ |
13 A/B/c/A/ c>d e>deg | dB/A/ gB +trill+A2 +trill+e2 ::
14 g>ecg ec e/=f/g/e/ | d/c/B/A/ Gd BG B/c/d/B/ |
15 g/f/e/d/ c/d/e/f/ gc e/f/g/e/ | dB/A/ gB +trill+A2 +trill+e2 :|»;
16
17 my $match = $abc ~~ m/ <ABC::tune> /;
18
19 die "Tune not matched\n" unless $match ~~ Match;
20
21 my @notes = gather for $match<ABC::tune><music><line_of_music> -> $line
22 {
23 for $line<bar> -> $bar
24 {
25 for $bar<element>
26 {
27 when .<broken_rhythm> { take .<broken_rhythm><note>[0]; take .<broken_rhythm><note>[1]; }
28 when .<note> { take .<note>; }
29 }
30 }
31 }
32
33 my %header = header_hash($match<ABC::tune><header>);
34 my %key_signature = key_signature(%header<K>);
35
36 @notes.map({say .<pitch> ~ " => " ~ apply_key_signature(%key_signature, .<pitch>)});
Something went wrong with that request. Please try again.