Skip to content

Commit

Permalink
add abc file, add tune_header, add test expectation for tune
Browse files Browse the repository at this point in the history
  • Loading branch information
domgetter committed Aug 6, 2014
1 parent 998de07 commit 087927b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ build/
.rvmrc

#test files for parsing
*.abc
3 changes: 2 additions & 1 deletion lib/abc/tune.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

module ABC
class Tune
attr_reader :header
def initialize(tune)

@header = TuneHeader.new
end
end
end
6 changes: 6 additions & 0 deletions lib/abc/tune_header.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

module ABC
class TuneHeader

end
end
3 changes: 2 additions & 1 deletion lib/abc_parser.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'pry'
require 'abc/file'
require 'abc/file_header'
require 'abc/tune'
require 'abc/tune'
require 'abc/tune_header'
4 changes: 3 additions & 1 deletion spec/abc/tune_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#
describe ABC::Tune do
let(:tune) {ABC::File.new("spec/fixtures/english.abc").tunes[0]}
it "should have a header"
it "should have a header" do
expect(tune.header)
end
it "should have a body"
it "should have a reference number of 1"
it "should have the title 'Dusty Miller, The'"
Expand Down
56 changes: 56 additions & 0 deletions spec/fixtures/english.abc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
%abc-2.1
H:This file contains some example English tunes
% note that the comments (like this one) are to highlight usages
% and would not normally be included in such detail
O:England % the origin of all tunes is England

X:1 % tune no 1
T:Dusty Miller, The % title
T:Binny's Jig % an alternative title
C:Trad. % traditional
R:DH % double hornpipe
M:3/4 % meter
K:G % key
B>cd BAG|FA Ac BA|B>cd BAG|DG GB AG:|
Bdd gfg|aA Ac BA|Bdd gfa|gG GB AG:|
BG G/2G/2G BG|FA Ac BA|BG G/2G/2G BG|DG GB AG:|
W:Hey, the dusty miller, and his dusty coat;
W:He will win a shilling, or he spend a groat.
W:Dusty was the coat, dusty was the colour;
W:Dusty was the kiss, that I got frae the miller.

X:2
T:Old Sir Simon the King
C:Trad.
S:Offord MSS % from Offord manuscript
N:see also Playford % reference note
M:9/8
R:SJ % slip jig
N:originally in C % transcription note
K:G
D|GFG GAG G2D|GFG GAG F2D|EFE EFE EFG|A2G F2E D2:|
D|GAG GAB d2D|GAG GAB c2D|[1 EFE EFE EFG|A2G F2E D2:|\ % no line-break in score
M:12/8 % change of meter
[2 E2E EFE E2E EFG|\ % no line-break in score
M:9/8 % change of meter
A2G F2E D2|]

X:3
T:William and Nancy
T:New Mown Hay
T:Legacy, The
C:Trad.
O:England; Gloucs; Bledington % place of origin
B:Sussex Tune Book % can be found in these books
B:Mally's Cotswold Morris vol.1 2
D:Morris On % can be heard on this record
P:(AB)2(AC)2A % play the parts in this order
M:6/8
K:G
[P:A] D|"G"G2G GBd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
[P:B] d|"G"e2d B2d|"C"gfe "G"d2d| "G"e2d B2d|"C"gfe "D7"d2c|
"G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
% changes of meter, using inline fields
[T:Slows][M:4/4][L:1/4][P:C]"G"d2|"C"e2 "G"d2|B2 d2|"Em"gf "A7"e2|"D7"d2 "G"d2|\
"C"e2 "G"d2|[M:3/8][L:1/8] "G"B2 d |[M:6/8] "C"gfe "D7"d2c|
"G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|

0 comments on commit 087927b

Please sign in to comment.