gitara 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,7 +1,8 @@
1
1
  *.gem
2
2
  *.ps
3
- .bundle
3
+ git.bundle
4
4
  .geanyprj
5
+ .rvmrc
5
6
  Gemfile.lock
6
7
  files/*
7
8
  pkg/*
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,8 @@
1
+ 0.4.0 - 2012-02-26
2
+ ------------------
3
+
4
+ * [#16] Add chord labels.
5
+
1
6
  0.3.1 - 2012-02-24
2
7
  ------------------
3
8
 
data/README.markdown CHANGED
@@ -8,6 +8,8 @@ Installation
8
8
 
9
9
  You need to have [lilypond](http://lilypond.org) 2.12 or higher to generate pdfs and midis.
10
10
 
11
+ Gitara is tested on 1.9.3 only. Patches are welcome.
12
+
11
13
 
12
14
  Usage
13
15
  ------
@@ -178,6 +180,27 @@ Stanzas
178
180
 
179
181
  The names of a stanza will be displayed at the top of the stanza's first bar.
180
182
 
183
+ Chord labels (optional)
184
+ -----------------------
185
+
186
+ You can add chord labels to bars:
187
+
188
+ Gitara.define do
189
+ chords :FC, 'r4-"F" r r-"C" r'
190
+
191
+ bar :BeganIt do
192
+ notes "/skip 4 <a/3 c'/2 >8 <g/3>8 /skip 4 <g/3 c'/2 >8 <g/3>8"
193
+ notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
194
+ chords :FC
195
+ end
196
+ end
197
+
198
+ `r4-"F" r r-"C" r` is a [lilypond music expression](http://lilypond.org/doc/v2.12/Documentation/user/lilypond-learning/Music-expressions-explained).
199
+
200
+ * `r` is a rest. `r4` is a rest that is a quarter note long. Succeeding rests have the same duration as the first one.
201
+ * `-"F"` means 'place the text "F" below the rest note'. See http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Writing-text.
202
+
203
+ When these chord labels are added to the Gitara lilypond output, Gitara hides the rest notes so only the chord labels are visible.
181
204
 
182
205
  Properties
183
206
  ----------
@@ -198,7 +221,7 @@ A gitara file can have the following optional properties:
198
221
  * composer - song's composer
199
222
  * instrument - description of the instrument used on the tab
200
223
  * midi_instrument - the type of instrument played in the midi export of the tab. By default, "acoustic guitar (nylon)".
201
- * tempo - see (lilypond)[http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Writing-parts#Metronome-marks] for the format.
224
+ * tempo - see [lilypond](http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Writing-parts#Metronome-marks) for the format.
202
225
  * title - title of the song
203
226
  * transposition - adjusts the pitch of the instrument. The default transposition is "c". If you set it to "d", then you have to play the tab two frets higher on the guitar (capo on second fret).
204
227
 
@@ -230,15 +253,3 @@ Workflow
230
253
 
231
254
  I'm no Lilypond expert (heh). When writing a tab, I use [TuxGuitar](http://tuxguitar.herac.com.ar) to transcribe a set of notes (usually just one bar). I then export the TuxGuitar tab to lilypond so that I can get the lilypond notes. I then place these lilypond notes inside my Gitara tab. This workflow allows me to use TuxGuitar's GUI for transcribing notes while allowing me to use Gitara's features for naming expressions and reusing them.
232
255
 
233
-
234
- To do
235
- -----
236
-
237
- For version 1, I want to convert this lilypond file to Gitara format:
238
-
239
- * [https://github.com/gsmendoza/tabs/tree/master/aimee-mann-wise-up](https://github.com/gsmendoza/tabs/tree/master/aimee-mann-wise-up)
240
-
241
- The remaining features are:
242
-
243
- 1. Properties like the title and authors
244
- 2. Chord labels
@@ -12,68 +12,99 @@
12
12
  instrument = "Guitar (capo on second fret)"
13
13
  }
14
14
 
15
+ %-----------------------------------------------------------------------
16
+ % Chord Sets
17
+
18
+ cChordSetAm = { r4-"Am" r r r }
19
+ cChordSetAmC = { r4-"Am" r r-"C" r }
20
+ cChordSetBbF = { r4-"Bb" r r-"F" r }
21
+ cChordSetCCGE = { r4-"C" r r-"G" r-"E" }
22
+ cChordSetD = { r4-"D" r r r }
23
+ cChordSetFC = { r4-"F" r r-"C" r }
24
+ cChordSetFD = { r4-"F" r r-"D" r }
25
+
15
26
  %-----------------------------------------------------------------------
16
27
  % Bars
17
28
 
18
29
  vOneBarBeforeYouSign = { r8 <d'\2>16( <c'\2>8.) <a\3>16 <c'\2>8. <d'\2>16 <e'\1>8. <g\3>8 }
19
30
  vTwoBarBeforeYouSign = { <d\4>4 <d\4>4 <d\4>4 <d\4>4 }
31
+ cBarBeforeYouSign = { \cChordSetD }
20
32
 
21
33
  vOneBarBeganIt = { \skip 4 <a\3 c'\2 >8 <g\3>8 \skip 4 <g\3 c'\2 >8 <g\3>8 }
22
34
  vTwoBarBeganIt = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
35
+ cBarBeganIt = { \cChordSetFC }
23
36
 
24
37
  vOneBarItThough = { r8 <d'\2>16( <c'\2>16) r8 <a\3>16 <c'\2>16 r8 <d'\2>16( <c'\2>16) r8 <a\3>8 }
25
38
  vTwoBarItThough = { <f\4>4 <f\4>4 <d\4>4 <d\4>4 }
39
+ cBarItThough = { \cChordSetFD }
26
40
 
27
41
  vOneBarFDm = { r8 <a\3>8 <c'\2>8 <a\3>8 r8 <d'\2>8 <a\3>8 <e'\1>8 }
28
42
  vTwoBarFDm = { <f\4>4 <f\4>4 <d\4>2 }
43
+ cBarFDm = { \cChordSetFD }
29
44
 
30
45
  vOneBarIntro = { <g'\1>8 <a\3>8 <g'\1>8 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>8 }
31
46
  vTwoBarIntro = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
47
+ cBarIntro = { \cChordSetFC }
32
48
 
33
49
  vOneBarItsNot = { r8 <g'\1>4 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>16( <a\3>16) }
34
50
  vTwoBarItsNot = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
51
+ cBarItsNot = { \cChordSetFC }
35
52
 
36
53
  vOneBarItsNotGoingToStop = { <g'\1>8 <a\3>8 <g'\1>16 <g'\1>16\glissando <a'\1>4 <e'\2>4 <d'\2>16( <c'\2>16) }
37
54
  vTwoBarItsNotGoingToStop = { <f\4>4 <f\4>4 <d\4>4 <d\4>4 }
55
+ cBarItsNotGoingToStop = { \cChordSetFD }
38
56
 
39
57
  vOneBarItsNotGoingToStopCcge = { <g'\1>8 <g\3>8 <g'\1>16 <g'\1>16\glissando <a'\1>4 <d'\2>4 <c'\2>8 }
40
58
  vTwoBarItsNotGoingToStopCcge = { <c\5>4 <c\5>4 <g,\6>4 <e,\6>4 }
59
+ cBarItsNotGoingToStopCcge = { \cChordSetCCGE }
41
60
 
42
61
  vOneBarItsNotGoingToStopCcgeTwo = { r8 <g\3>8 <e'\1>8 <g'\1>8 r8 <d'\2>4 <c'\2>8 }
43
62
  vTwoBarItsNotGoingToStopCcgeTwo = { <c\5>4 <e\4>4 <g,\6>4 <e,\6>4 }
63
+ cBarItsNotGoingToStopCcgeTwo = { \cChordSetCCGE }
44
64
 
45
65
  vOneBarOutro = { <g'\1>8 <a\3>8 <g'\1>8 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>8 }
46
66
  vTwoBarOutro = { <a,\5>4 <a,\5>4 <c\5>4 <c\5>4 }
67
+ cBarOutro = { \cChordSetAmC }
47
68
 
48
69
  vOneBarPrepareAList = { <e'\1>8 <d'\2>16( <c'\2>8.) <a\3>16 <c'\2>8. <d'\2>16 <e'\1>8. <a\3>16 <e'\1>16 }
49
70
  vTwoBarPrepareAList = { <a,\5>4 <a,\5>4 <a,\5>4 <a,\5>4 }
71
+ cBarPrepareAList = { \cChordSetAm }
50
72
 
51
73
  vOneBarSoJustGiveUp = { r8 <g\3>8 <c'\2>8 <a\3>8 <a\3 c'\2 g'\1 f\4 >4 <c'\3 e'\2 a'\1 >4 }
52
74
  vTwoBarSoJustGiveUp = { <as,\5>4 <d\4>4 \skip 2 }
75
+ cBarSoJustGiveUp = { \cChordSetBbF }
53
76
 
54
77
  vOneBarTheresACure = { r8 <d'\2>16( <c'\2>8.) <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>8 }
55
78
  vTwoBarTheresACure = { <f\4>4 <f\4>4 <c\5>4 <c\5>4 }
79
+ cBarTheresACure = { \cChordSetFC }
56
80
 
57
81
  vOneBarTilYouWiseUp = { r8 <g\3>8 <c'\2>8 <g\3>8 <d'\2>4 <a\3>4 }
58
82
  vTwoBarTilYouWiseUp = { <as,\5>4 <d\4>4 <f\4>4 <f\4>4 }
83
+ cBarTilYouWiseUp = { \cChordSetBbF }
59
84
 
60
85
  vOneBarTilYouWiseUpTwo = { r8 <g\3>8 <c'\2>8 <g\3>8 <d'\2>8 <a\3>8 r8 <c'\2>8 }
61
86
  vTwoBarTilYouWiseUpTwo = { <as,\5>4 <d\4>4 <f\4>4 <f\4>4 }
87
+ cBarTilYouWiseUpTwo = { \cChordSetBbF }
62
88
 
63
89
  vOneBarTilYouWiseUpThree = { r8 <g\3>8 <c'\2>8 <a\3>8 <d'\2>8 <e'\1>8 r8 <e'\1>8 }
64
90
  vTwoBarTilYouWiseUpThree = { <as,\5>4 <d\4>4 <f\4>4 <f\4>4 }
91
+ cBarTilYouWiseUpThree = { \cChordSetBbF }
65
92
 
66
93
  vOneBarWhatYouThought = { r8 <g'\1>4 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>8 }
67
94
  vTwoBarWhatYouThought = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
95
+ cBarWhatYouThought = { \cChordSetFC }
68
96
 
69
97
  vOneBarWhenYouFirst = { <e'\1>8 <d'\2>16( <c'\2>8) <a\3>8. <c'\2>4 <a\3>8 <c'\2>8 }
70
98
  vTwoBarWhenYouFirst = { <a,\5>4 <a,\5>8 <e\4>4 <a,\5>4 \skip 8 }
99
+ cBarWhenYouFirst = { \cChordSetAm }
71
100
 
72
101
  vOneBarYouGot = { <g'\1>8 <a\3>8 <g'\1>8 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>16( <a\3>16) }
73
102
  vTwoBarYouGot = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
103
+ cBarYouGot = { \cChordSetFC }
74
104
 
75
105
  vOneBarYoureSure = { r8 <g'\1>4 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <e'\1>8 }
76
106
  vTwoBarYoureSure = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
107
+ cBarYoureSure = { \cChordSetFC }
77
108
 
78
109
 
79
110
  %-----------------------------------------------------------------------
@@ -81,36 +112,47 @@ vTwoBarYoureSure = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
81
112
 
82
113
  vOneLineChorusOneLineOne = { \vOneBarItsNotGoingToStop \vOneBarFDm \vOneBarItsNotGoingToStop \vOneBarFDm \break }
83
114
  vTwoLineChorusOneLineOne = { \vTwoBarItsNotGoingToStop \vTwoBarFDm \vTwoBarItsNotGoingToStop \vTwoBarFDm \break }
115
+ cLineChorusOneLineOne = { \cBarItsNotGoingToStop \cBarFDm \cBarItsNotGoingToStop \cBarFDm }
84
116
 
85
117
  vOneLineIntroLineOne = { \vOneBarIntro \vOneBarIntro \vOneBarIntro \vOneBarIntro \break }
86
118
  vTwoLineIntroLineOne = { \vTwoBarIntro \vTwoBarIntro \vTwoBarIntro \vTwoBarIntro \break }
119
+ cLineIntroLineOne = { \cBarIntro \cBarIntro \cBarIntro \cBarIntro }
87
120
 
88
121
  vOneLineVerseOneLineTwo = { \vOneBarYouGot \vOneBarWhatYouThought \vOneBarWhenYouFirst \vOneBarItThough \break }
89
122
  vTwoLineVerseOneLineTwo = { \vTwoBarYouGot \vTwoBarWhatYouThought \vTwoBarWhenYouFirst \vTwoBarItThough \break }
123
+ cLineVerseOneLineTwo = { \cBarYouGot \cBarWhatYouThought \cBarWhenYouFirst \cBarItThough }
90
124
 
91
125
  vOneLineVerseOneLineOne = { \vOneBarItsNot \vOneBarWhatYouThought \vOneBarWhenYouFirst \vOneBarBeganIt \break }
92
126
  vTwoLineVerseOneLineOne = { \vTwoBarItsNot \vTwoBarWhatYouThought \vTwoBarWhenYouFirst \vTwoBarBeganIt \break }
127
+ cLineVerseOneLineOne = { \cBarItsNot \cBarWhatYouThought \cBarWhenYouFirst \cBarBeganIt }
93
128
 
94
129
  vOneLineChorusOneLineTwo = { \vOneBarItsNotGoingToStopCcge \vOneBarTilYouWiseUp \vOneBarIntro \vOneBarIntro \break }
95
130
  vTwoLineChorusOneLineTwo = { \vTwoBarItsNotGoingToStopCcge \vTwoBarTilYouWiseUp \vTwoBarIntro \vTwoBarIntro \break }
131
+ cLineChorusOneLineTwo = { \cBarItsNotGoingToStopCcge \cBarTilYouWiseUp \cBarIntro \cBarIntro }
96
132
 
97
133
  vOneLineVerseTwoLineOne = { \vOneBarYoureSure \vOneBarTheresACure \vOneBarWhenYouFirst \vOneBarBeganIt \break }
98
134
  vTwoLineVerseTwoLineOne = { \vTwoBarYoureSure \vTwoBarTheresACure \vTwoBarWhenYouFirst \vTwoBarBeganIt \break }
135
+ cLineVerseTwoLineOne = { \cBarYoureSure \cBarTheresACure \cBarWhenYouFirst \cBarBeganIt }
99
136
 
100
137
  vOneLineChorusTwoLineTwo = { \vOneBarItsNotGoingToStopCcge \vOneBarTilYouWiseUpTwo \vOneBarIntro \vOneBarIntro \break }
101
138
  vTwoLineChorusTwoLineTwo = { \vTwoBarItsNotGoingToStopCcge \vTwoBarTilYouWiseUpTwo \vTwoBarIntro \vTwoBarIntro \break }
139
+ cLineChorusTwoLineTwo = { \cBarItsNotGoingToStopCcge \cBarTilYouWiseUpTwo \cBarIntro \cBarIntro }
102
140
 
103
141
  vOneLineBridgeLineOne = { \vOneBarPrepareAList \vOneBarBeforeYouSign \break }
104
142
  vTwoLineBridgeLineOne = { \vTwoBarPrepareAList \vTwoBarBeforeYouSign \break }
143
+ cLineBridgeLineOne = { \cBarPrepareAList \cBarBeforeYouSign }
105
144
 
106
145
  vOneLineChorusThreeLineTwo = { \vOneBarItsNotGoingToStopCcge \vOneBarTilYouWiseUpThree \vOneBarItsNotGoingToStopCcgeTwo \vOneBarTilYouWiseUpThree \break }
107
146
  vTwoLineChorusThreeLineTwo = { \vTwoBarItsNotGoingToStopCcge \vTwoBarTilYouWiseUpThree \vTwoBarItsNotGoingToStopCcgeTwo \vTwoBarTilYouWiseUpThree \break }
147
+ cLineChorusThreeLineTwo = { \cBarItsNotGoingToStopCcge \cBarTilYouWiseUpThree \cBarItsNotGoingToStopCcgeTwo \cBarTilYouWiseUpThree }
108
148
 
109
149
  vOneLineChorusThreeLineThree = { \vOneBarItsNotGoingToStopCcgeTwo \vOneBarTilYouWiseUpThree \vOneBarItsNotGoingToStopCcgeTwo \vOneBarSoJustGiveUp \break }
110
150
  vTwoLineChorusThreeLineThree = { \vTwoBarItsNotGoingToStopCcgeTwo \vTwoBarTilYouWiseUpThree \vTwoBarItsNotGoingToStopCcgeTwo \vTwoBarSoJustGiveUp \break }
151
+ cLineChorusThreeLineThree = { \cBarItsNotGoingToStopCcgeTwo \cBarTilYouWiseUpThree \cBarItsNotGoingToStopCcgeTwo \cBarSoJustGiveUp }
111
152
 
112
153
  vOneLineOutroLineTwo = { \vOneBarOutro \vOneBarOutro \vOneBarOutro \vOneBarOutro \break }
113
154
  vTwoLineOutroLineTwo = { \vTwoBarOutro \vTwoBarOutro \vTwoBarOutro \vTwoBarOutro \break }
155
+ cLineOutroLineTwo = { \cBarOutro \cBarOutro \cBarOutro \cBarOutro }
114
156
 
115
157
 
116
158
  %-----------------------------------------------------------------------
@@ -118,27 +160,35 @@ vTwoLineOutroLineTwo = { \vTwoBarOutro \vTwoBarOutro \vTwoBarOutro \vTwoBarOutro
118
160
 
119
161
  vOneStanzaIntro = { \vOneLineIntroLineOne }
120
162
  vTwoStanzaIntro = { \vTwoLineIntroLineOne }
163
+ cStanzaIntro = { \cLineIntroLineOne }
121
164
 
122
165
  vOneStanzaVerseOne = { \vOneLineVerseOneLineOne \vOneLineVerseOneLineTwo }
123
166
  vTwoStanzaVerseOne = { \vTwoLineVerseOneLineOne \vTwoLineVerseOneLineTwo }
167
+ cStanzaVerseOne = { \cLineVerseOneLineOne \cLineVerseOneLineTwo }
124
168
 
125
169
  vOneStanzaChorusOne = { \vOneLineChorusOneLineOne \vOneLineChorusOneLineTwo }
126
170
  vTwoStanzaChorusOne = { \vTwoLineChorusOneLineOne \vTwoLineChorusOneLineTwo }
171
+ cStanzaChorusOne = { \cLineChorusOneLineOne \cLineChorusOneLineTwo }
127
172
 
128
173
  vOneStanzaVerseTwo = { \vOneLineVerseTwoLineOne \vOneLineVerseOneLineTwo }
129
174
  vTwoStanzaVerseTwo = { \vTwoLineVerseTwoLineOne \vTwoLineVerseOneLineTwo }
175
+ cStanzaVerseTwo = { \cLineVerseTwoLineOne \cLineVerseOneLineTwo }
130
176
 
131
177
  vOneStanzaChorusTwo = { \vOneLineChorusOneLineOne \vOneLineChorusTwoLineTwo }
132
178
  vTwoStanzaChorusTwo = { \vTwoLineChorusOneLineOne \vTwoLineChorusTwoLineTwo }
179
+ cStanzaChorusTwo = { \cLineChorusOneLineOne \cLineChorusTwoLineTwo }
133
180
 
134
181
  vOneStanzaBridge = { \vOneLineBridgeLineOne }
135
182
  vTwoStanzaBridge = { \vTwoLineBridgeLineOne }
183
+ cStanzaBridge = { \cLineBridgeLineOne }
136
184
 
137
185
  vOneStanzaChorusThree = { \vOneLineChorusOneLineOne \vOneLineChorusThreeLineTwo \vOneLineChorusThreeLineThree }
138
186
  vTwoStanzaChorusThree = { \vTwoLineChorusOneLineOne \vTwoLineChorusThreeLineTwo \vTwoLineChorusThreeLineThree }
187
+ cStanzaChorusThree = { \cLineChorusOneLineOne \cLineChorusThreeLineTwo \cLineChorusThreeLineThree }
139
188
 
140
189
  vOneStanzaOutro = { \vOneLineIntroLineOne \vOneLineOutroLineTwo }
141
190
  vTwoStanzaOutro = { \vTwoLineIntroLineOne \vTwoLineOutroLineTwo }
191
+ cStanzaOutro = { \cLineIntroLineOne \cLineOutroLineTwo }
142
192
 
143
193
 
144
194
  %-----------------------------------------------------------------------
@@ -146,6 +196,7 @@ vTwoStanzaOutro = { \vTwoLineIntroLineOne \vTwoLineOutroLineTwo }
146
196
 
147
197
  vOneScoreTabOneScoreOne = { \vOneStanzaIntro \vOneStanzaVerseOne \vOneStanzaChorusOne \vOneStanzaVerseTwo \vOneStanzaChorusTwo \vOneStanzaBridge \vOneStanzaChorusThree \vOneStanzaOutro }
148
198
  vTwoScoreTabOneScoreOne = { \vTwoStanzaIntro \vTwoStanzaVerseOne \vTwoStanzaChorusOne \vTwoStanzaVerseTwo \vTwoStanzaChorusTwo \vTwoStanzaBridge \vTwoStanzaChorusThree \vTwoStanzaOutro }
199
+ cScoreTabOneScoreOne = { \cStanzaIntro \cStanzaVerseOne \cStanzaChorusOne \cStanzaVerseTwo \cStanzaChorusTwo \cStanzaBridge \cStanzaChorusThree \cStanzaOutro }
149
200
 
150
201
 
151
202
  %-----------------------------------------------------------------------
@@ -176,6 +227,11 @@ stanzaHeadings = {
176
227
  r1^"Outro" r r r r r r r
177
228
  }
178
229
 
230
+ %-----------------------------------------------------------------------
231
+ % Chord Headings
232
+
233
+ chordHeadings = { \cScoreTabOneScoreOne }
234
+
179
235
  %-----------------------------------------------------------------------
180
236
 
181
237
  \score {
@@ -208,6 +264,9 @@ stanzaHeadings = {
208
264
  \slurUp
209
265
  \vTwo
210
266
  }
267
+ \new TabVoice {
268
+ \chordHeadings
269
+ }
211
270
  >>
212
271
  >>
213
272
 
@@ -7,104 +7,132 @@ Gitara.define do
7
7
  tempo "4 = 75"
8
8
  transposition "d"
9
9
 
10
+ chords :Am, 'r4-"Am" r r r'
11
+ chords :AmC, 'r4-"Am" r r-"C" r'
12
+ chords :BbF, 'r4-"Bb" r r-"F" r'
13
+ chords :CCGE, 'r4-"C" r r-"G" r-"E"'
14
+ chords :D, 'r4-"D" r r r'
15
+ chords :FC, 'r4-"F" r r-"C" r'
16
+ chords :FD, 'r4-"F" r r-"D" r'
17
+
10
18
  bar :BeforeYouSign do
11
19
  notes "r8 <d'/2>16( <c'/2>8.) <a/3>16 <c'/2>8. <d'/2>16 <e'/1>8. <g/3>8"
12
20
  notes "<d/4>4 <d/4>4 <d/4>4 <d/4>4"
21
+ chords :D
13
22
  end
14
23
 
15
24
  bar :BeganIt do
16
25
  notes "/skip 4 <a/3 c'/2 >8 <g/3>8 /skip 4 <g/3 c'/2 >8 <g/3>8"
17
26
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
27
+ chords :FC
18
28
  end
19
29
 
20
30
  bar :ItThough do
21
31
  notes "r8 <d'/2>16( <c'/2>16) r8 <a/3>16 <c'/2>16 r8 <d'/2>16( <c'/2>16) r8 <a/3>8"
22
32
  notes "<f/4>4 <f/4>4 <d/4>4 <d/4>4"
33
+ chords :FD
23
34
  end
24
35
 
25
36
  bar :FDm do
26
37
  notes "r8 <a/3>8 <c'/2>8 <a/3>8 r8 <d'/2>8 <a/3>8 <e'/1>8"
27
38
  notes "<f/4>4 <f/4>4 <d/4>2"
39
+ chords :FD
28
40
  end
29
41
 
30
42
  bar :Intro do
31
43
  notes "<g'/1>8 <a/3>8 <g'/1>8 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>8"
32
44
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
45
+ chords :FC
33
46
  end
34
47
 
35
48
  bar :ItsNot do
36
49
  notes "r8 <g'/1>4 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>16( <a/3>16)"
37
50
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
51
+ chords :FC
38
52
  end
39
53
 
40
54
  bar :ItsNotGoingToStop do
41
55
  notes "<g'/1>8 <a/3>8 <g'/1>16 <g'/1>16/glissando <a'/1>4 <e'/2>4 <d'/2>16( <c'/2>16)"
42
56
  notes "<f/4>4 <f/4>4 <d/4>4 <d/4>4"
57
+ chords :FD
43
58
  end
44
59
 
45
60
  bar :ItsNotGoingToStopCcge do
46
61
  notes "<g'/1>8 <g/3>8 <g'/1>16 <g'/1>16/glissando <a'/1>4 <d'/2>4 <c'/2>8"
47
62
  notes "<c/5>4 <c/5>4 <g,/6>4 <e,/6>4"
63
+ chords :CCGE
48
64
  end
49
65
 
50
66
  bar :ItsNotGoingToStopCcgeTwo do
51
67
  notes "r8 <g/3>8 <e'/1>8 <g'/1>8 r8 <d'/2>4 <c'/2>8"
52
68
  notes "<c/5>4 <e/4>4 <g,/6>4 <e,/6>4"
69
+ chords :CCGE
53
70
  end
54
71
 
55
72
  bar :Outro do
56
73
  notes "<g'/1>8 <a/3>8 <g'/1>8 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>8"
57
74
  notes "<a,/5>4 <a,/5>4 <c/5>4 <c/5>4"
75
+ chords :AmC
58
76
  end
59
77
 
60
78
  bar :PrepareAList do
61
79
  notes "<e'/1>8 <d'/2>16( <c'/2>8.) <a/3>16 <c'/2>8. <d'/2>16 <e'/1>8. <a/3>16 <e'/1>16"
62
80
  notes "<a,/5>4 <a,/5>4 <a,/5>4 <a,/5>4"
81
+ chords :Am
63
82
  end
64
83
 
65
84
  bar :SoJustGiveUp do
66
85
  notes "r8 <g/3>8 <c'/2>8 <a/3>8 <a/3 c'/2 g'/1 f/4 >4 <c'/3 e'/2 a'/1 >4"
67
86
  notes "<as,/5>4 <d/4>4 /skip 2"
87
+ chords :BbF
68
88
  end
69
89
 
70
90
  bar :TheresACure do
71
91
  notes "r8 <d'/2>16( <c'/2>8.) <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>8"
72
92
  notes "<f/4>4 <f/4>4 <c/5>4 <c/5>4"
93
+ chords :FC
73
94
  end
74
95
 
75
96
  bar :TilYouWiseUp do
76
97
  notes "r8 <g/3>8 <c'/2>8 <g/3>8 <d'/2>4 <a/3>4"
77
98
  notes "<as,/5>4 <d/4>4 <f/4>4 <f/4>4"
99
+ chords :BbF
78
100
  end
79
101
 
80
102
  bar :TilYouWiseUpTwo do
81
103
  notes "r8 <g/3>8 <c'/2>8 <g/3>8 <d'/2>8 <a/3>8 r8 <c'/2>8"
82
104
  notes "<as,/5>4 <d/4>4 <f/4>4 <f/4>4"
105
+ chords :BbF
83
106
  end
84
107
 
85
108
  bar :TilYouWiseUpThree do
86
109
  notes "r8 <g/3>8 <c'/2>8 <a/3>8 <d'/2>8 <e'/1>8 r8 <e'/1>8"
87
110
  notes "<as,/5>4 <d/4>4 <f/4>4 <f/4>4"
111
+ chords :BbF
88
112
  end
89
113
 
90
114
  bar :WhatYouThought do
91
115
  notes "r8 <g'/1>4 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>8"
92
116
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
117
+ chords :FC
93
118
  end
94
119
 
95
120
  bar :WhenYouFirst do
96
121
  notes "<e'/1>8 <d'/2>16( <c'/2>8) <a/3>8. <c'/2>4 <a/3>8 <c'/2>8"
97
122
  notes "<a,/5>4 <a,/5>8 <e/4>4 <a,/5>4 /skip 8"
123
+ chords :Am
98
124
  end
99
125
 
100
126
  bar :YouGot do
101
127
  notes "<g'/1>8 <a/3>8 <g'/1>8 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>16( <a/3>16)"
102
128
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
129
+ chords :FC
103
130
  end
104
131
 
105
132
  bar :YoureSure do
106
133
  notes "r8 <g'/1>4 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <e'/1>8"
107
134
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
135
+ chords :FC
108
136
  end
109
137
 
110
138
  #-----------------------------------------------------------------------
data/examples/tab.ly CHANGED
@@ -12,26 +12,43 @@
12
12
  instrument = "Guitar (capo on second fret)"
13
13
  }
14
14
 
15
+ %-----------------------------------------------------------------------
16
+ % Chord Sets
17
+
18
+ cChordSetAm = { r4-"Am" r r r }
19
+ cChordSetAmC = { r4-"Am" r r-"C" r }
20
+ cChordSetBbF = { r4-"Bb" r r-"F" r }
21
+ cChordSetCCGE = { r4-"C" r r-"G" r-"E" }
22
+ cChordSetD = { r4-"D" r r r }
23
+ cChordSetFC = { r4-"F" r r-"C" r }
24
+ cChordSetFD = { r4-"F" r r-"D" r }
25
+
15
26
  %-----------------------------------------------------------------------
16
27
  % Bars
17
28
 
18
29
  vOneBarBeganIt = { \skip 4 <a\3 c'\2 >8 <g\3>8 \skip 4 <g\3 c'\2 >8 <g\3>8 }
19
30
  vTwoBarBeganIt = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
31
+ cBarBeganIt = { \cChordSetFC }
20
32
 
21
33
  vOneBarItsNot = { r8 <g'\1>4 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>16( <a\3>16) }
22
34
  vTwoBarItsNot = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
35
+ cBarItsNot = { \cChordSetFC }
23
36
 
24
37
  vOneBarItThough = { r8 <d'\2>16( <c'\2>16) r8 <a\3>16 <c'\2>16 r8 <d'\2>16( <c'\2>16) r8 <a\3>8 }
25
38
  vTwoBarItThough = { <f\4>4 <f\4>4 <d\4>4 <d\4>4 }
39
+ cBarItThough = { \cChordSetFD }
26
40
 
27
41
  vOneBarWhatYouThought = { r8 <g'\1>4 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>8 }
28
42
  vTwoBarWhatYouThought = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
43
+ cBarWhatYouThought = { \cChordSetFC }
29
44
 
30
45
  vOneBarWhenYouFirst = { <e'\1>8 <d'\2>16( <c'\2>8) <a\3>8. <c'\2>4 <a\3>8 <c'\2>8 }
31
46
  vTwoBarWhenYouFirst = { <a,\5>4 <a,\5>8 <e\4>4 <a,\5>4 \skip 8 }
47
+ cBarWhenYouFirst = { \cChordSetAm }
32
48
 
33
49
  vOneBarYouGot = { <g'\1>8 <a\3>8 <g'\1>8 <a\3>16 <g'\1>8 <g\3>16 <e'\1>4 <g\3>16( <a\3>16) }
34
50
  vTwoBarYouGot = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
51
+ cBarYouGot = { \cChordSetFC }
35
52
 
36
53
 
37
54
  %-----------------------------------------------------------------------
@@ -39,9 +56,11 @@ vTwoBarYouGot = { <f\4>4 <f\4>4 <c\5>4 <e\4>4 }
39
56
 
40
57
  vOneLineVerseOneLineTwo = { \vOneBarYouGot \vOneBarWhatYouThought \vOneBarWhenYouFirst \vOneBarItThough \break }
41
58
  vTwoLineVerseOneLineTwo = { \vTwoBarYouGot \vTwoBarWhatYouThought \vTwoBarWhenYouFirst \vTwoBarItThough \break }
59
+ cLineVerseOneLineTwo = { \cBarYouGot \cBarWhatYouThought \cBarWhenYouFirst \cBarItThough }
42
60
 
43
61
  vOneLineVerseOneLineOne = { \vOneBarItsNot \vOneBarWhatYouThought \vOneBarWhenYouFirst \vOneBarBeganIt \break }
44
62
  vTwoLineVerseOneLineOne = { \vTwoBarItsNot \vTwoBarWhatYouThought \vTwoBarWhenYouFirst \vTwoBarBeganIt \break }
63
+ cLineVerseOneLineOne = { \cBarItsNot \cBarWhatYouThought \cBarWhenYouFirst \cBarBeganIt }
45
64
 
46
65
 
47
66
  %-----------------------------------------------------------------------
@@ -49,6 +68,7 @@ vTwoLineVerseOneLineOne = { \vTwoBarItsNot \vTwoBarWhatYouThought \vTwoBarWhenYo
49
68
 
50
69
  vOneStanzaVerseOne = { \vOneLineVerseOneLineOne \vOneLineVerseOneLineTwo }
51
70
  vTwoStanzaVerseOne = { \vTwoLineVerseOneLineOne \vTwoLineVerseOneLineTwo }
71
+ cStanzaVerseOne = { \cLineVerseOneLineOne \cLineVerseOneLineTwo }
52
72
 
53
73
 
54
74
  %-----------------------------------------------------------------------
@@ -56,6 +76,7 @@ vTwoStanzaVerseOne = { \vTwoLineVerseOneLineOne \vTwoLineVerseOneLineTwo }
56
76
 
57
77
  vOneScoreTabOneScoreOne = { \vOneStanzaVerseOne }
58
78
  vTwoScoreTabOneScoreOne = { \vTwoStanzaVerseOne }
79
+ cScoreTabOneScoreOne = { \cStanzaVerseOne }
59
80
 
60
81
 
61
82
  %-----------------------------------------------------------------------
@@ -79,6 +100,11 @@ stanzaHeadings = {
79
100
  r1^"Verse 1" r r r r r r r
80
101
  }
81
102
 
103
+ %-----------------------------------------------------------------------
104
+ % Chord Headings
105
+
106
+ chordHeadings = { \cScoreTabOneScoreOne }
107
+
82
108
  %-----------------------------------------------------------------------
83
109
 
84
110
  \score {
@@ -111,6 +137,9 @@ stanzaHeadings = {
111
137
  \slurUp
112
138
  \vTwo
113
139
  }
140
+ \new TabVoice {
141
+ \chordHeadings
142
+ }
114
143
  >>
115
144
  >>
116
145
 
data/examples/tab.rb CHANGED
@@ -7,34 +7,48 @@ Gitara.define do
7
7
  transposition "d"
8
8
  tempo "4 = 75"
9
9
 
10
+ chords :Am, 'r4-"Am" r r r'
11
+ chords :AmC, 'r4-"Am" r r-"C" r'
12
+ chords :BbF, 'r4-"Bb" r r-"F" r'
13
+ chords :CCGE, 'r4-"C" r r-"G" r-"E"'
14
+ chords :D, 'r4-"D" r r r'
15
+ chords :FC, 'r4-"F" r r-"C" r'
16
+ chords :FD, 'r4-"F" r r-"D" r'
17
+
10
18
  bar :BeganIt do
11
19
  notes "/skip 4 <a/3 c'/2 >8 <g/3>8 /skip 4 <g/3 c'/2 >8 <g/3>8"
12
20
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
21
+ chords :FC
13
22
  end
14
23
 
15
24
  bar :ItsNot do
16
25
  notes "r8 <g'/1>4 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>16( <a/3>16)"
17
26
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
27
+ chords :FC
18
28
  end
19
29
 
20
30
  bar :ItThough do
21
31
  notes "r8 <d'/2>16( <c'/2>16) r8 <a/3>16 <c'/2>16 r8 <d'/2>16( <c'/2>16) r8 <a/3>8"
22
32
  notes "<f/4>4 <f/4>4 <d/4>4 <d/4>4"
33
+ chords :FD
23
34
  end
24
35
 
25
36
  bar :WhatYouThought do
26
37
  notes "r8 <g'/1>4 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>8"
27
38
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
39
+ chords :FC
28
40
  end
29
41
 
30
42
  bar :WhenYouFirst do
31
43
  notes "<e'/1>8 <d'/2>16( <c'/2>8) <a/3>8. <c'/2>4 <a/3>8 <c'/2>8"
32
44
  notes "<a,/5>4 <a,/5>8 <e/4>4 <a,/5>4 /skip 8"
45
+ chords :Am
33
46
  end
34
47
 
35
48
  bar :YouGot do
36
49
  notes "<g'/1>8 <a/3>8 <g'/1>8 <a/3>16 <g'/1>8 <g/3>16 <e'/1>4 <g/3>16( <a/3>16)"
37
50
  notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
51
+ chords :FC
38
52
  end
39
53
 
40
54
  line :VerseOneLineTwo do
data/lib/gitara/dsl.rb CHANGED
@@ -32,6 +32,10 @@ module Gitara
32
32
  add_names :names => names, :node_class => Node::Bar, &block
33
33
  end
34
34
 
35
+ def chords(name, value=nil)
36
+ add Node::ChordSet.new(:name => name, :value => value)
37
+ end
38
+
35
39
  def line(*names, &block)
36
40
  add_names :names => names, :node_class => Node::Line, &block
37
41
  end
@@ -0,0 +1,11 @@
1
+ module Gitara
2
+ module Node
3
+ class Bar
4
+ class ChordedNode < Base::ChordedNode
5
+ def value
6
+ node.descendants(Node::ChordSet).map(&:chorded).map(&:call_name).join(' ')
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ module Gitara
2
+ module Node
3
+ class Base
4
+ class ChordedNode < Valuable
5
+ has_value :node
6
+
7
+ def call_name
8
+ "\\#{definition_name}"
9
+ end
10
+
11
+ def definition_name
12
+ "c#{node.class.to_s.split('::').last}#{node.definition_name}"
13
+ end
14
+
15
+ def value
16
+ node.children.map(&:chorded).map(&:call_name).join(' ')
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -26,6 +26,10 @@ module Gitara
26
26
  end
27
27
  end
28
28
 
29
+ def chorded
30
+ self.class::ChordedNode.new(:node => self)
31
+ end
32
+
29
33
  def definition(target = self)
30
34
  if self.definition_of?(target)
31
35
  self
@@ -36,7 +40,7 @@ module Gitara
36
40
  end
37
41
 
38
42
  def definition?
39
- ! own_children.empty?
43
+ ! own_children.empty? || ! value.nil?
40
44
  end
41
45
 
42
46
  def definition_name
@@ -79,7 +83,7 @@ module Gitara
79
83
  end
80
84
 
81
85
  def value
82
- attributes[:value].gsub('/', "\\")
86
+ attributes[:value] ? attributes[:value].gsub('/', "\\") : nil
83
87
  end
84
88
 
85
89
  def voiced_as(arg)
@@ -0,0 +1,11 @@
1
+ module Gitara
2
+ module Node
3
+ class ChordSet
4
+ class ChordedNode < Base::ChordedNode
5
+ def value
6
+ node.value
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ module Gitara
2
+ module Node
3
+ class ChordSet < Base
4
+ end
5
+ end
6
+ end
@@ -1,3 +1,4 @@
1
1
  <% self.voiced_as(self.root.voices).each do |voiced_bar| %>
2
2
  <%= voiced_bar.definition_name %> = { <%= voiced_bar.matching_note_set.value %> }
3
3
  <% end %>
4
+ <%= self.chorded.definition_name %> = { <%= self.chorded.value %> }
@@ -0,0 +1 @@
1
+ <%= self.chorded.definition_name %> = { <%= self.chorded.value %> }
@@ -1,3 +1,4 @@
1
1
  <% self.voiced_as(self.root.voices).each do |voiced_line| %>
2
2
  <%= voiced_line.definition_name %> = { <%= voiced_line.children.map(&:call_name).join(' ') %> \break }
3
3
  <% end %>
4
+ <%= self.chorded.definition_name %> = { <%= self.chorded.value %> }
@@ -1,3 +1,4 @@
1
1
  <% self.voiced_as(self.root.voices).each do |voiced_score| %>
2
2
  <%= voiced_score.definition_name %> = { <%= voiced_score.children.map(&:call_name).join(' ') %> }
3
3
  <% end %>
4
+ <%= self.chorded.definition_name %> = { <%= self.chorded.value %> }
@@ -1,3 +1,4 @@
1
1
  <% self.voiced_as(self.root.voices).each do |voiced_stanza| %>
2
2
  <%= voiced_stanza.definition_name %> = { <%= voiced_stanza.children.map(&:call_name).join(' ') %> }
3
3
  <% end %>
4
+ <%= self.chorded.definition_name %> = { <%= self.chorded.value %> }
@@ -12,6 +12,13 @@
12
12
  instrument = "<%= self.instrument %>"
13
13
  }
14
14
 
15
+ %-----------------------------------------------------------------------
16
+ % Chord Sets
17
+
18
+ <% definitions(Gitara::Node::ChordSet).each do |chord_set| %>
19
+ <%= Gitara.render('chord_set', chord_set) %>
20
+ <% end %>
21
+
15
22
  %-----------------------------------------------------------------------
16
23
  % Bars
17
24
 
@@ -56,6 +63,11 @@ stanzaHeadings = {
56
63
  <% end %>
57
64
  }
58
65
 
66
+ %-----------------------------------------------------------------------
67
+ % Chord Headings
68
+
69
+ chordHeadings = { <%= playable_child.chorded.call_name %> }
70
+
59
71
  %-----------------------------------------------------------------------
60
72
 
61
73
  \score {
@@ -83,6 +95,9 @@ stanzaHeadings = {
83
95
  <%= voice.call_name %>
84
96
  }
85
97
  <% end %>
98
+ \new TabVoice {
99
+ \chordHeadings
100
+ }
86
101
  >>
87
102
  >>
88
103
 
@@ -1,3 +1,3 @@
1
1
  module Gitara
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
data/lib/gitara.rb CHANGED
@@ -8,9 +8,13 @@ require "valuable"
8
8
  require "gitara/app"
9
9
  require "gitara/dsl"
10
10
  require "gitara/node/base"
11
+ require "gitara/node/base/chorded_node"
11
12
  require "gitara/node/base/voiced_node"
12
13
  require "gitara/node/bar"
14
+ require "gitara/node/bar/chorded_node"
13
15
  require "gitara/node/bar/voiced_node"
16
+ require "gitara/node/chord_set"
17
+ require "gitara/node/chord_set/chorded_node"
14
18
  require "gitara/node/line"
15
19
  require "gitara/node/note_set"
16
20
  require "gitara/node/score"
@@ -215,5 +215,34 @@ describe Gitara do
215
215
  end
216
216
  end
217
217
  end
218
+
219
+ describe "chords(name, value)" do
220
+ it "should add a chord set with the name" do
221
+ dsl = Dsl.new(:node => Node::Tab.new)
222
+ dsl.node.own_children.should be_empty
223
+
224
+ dsl.chords :Am, 'r4-"Am" r r r'
225
+
226
+ dsl.node.own_children.should have(1).chord_set
227
+
228
+ chord_set = dsl.node.own_children[0]
229
+ chord_set.name.should == :Am
230
+ chord_set.value.should == 'r4-"Am" r r r'
231
+ end
232
+ end
233
+
234
+ describe "chords(name)" do
235
+ it "should add a bar with the name" do
236
+ dsl = Dsl.new(:node => Node::Tab.new)
237
+ dsl.node.own_children.should be_empty
238
+
239
+ dsl.chords :Am
240
+
241
+ dsl.node.own_children.should have(1).chord_set
242
+
243
+ chord_set = dsl.node.own_children[0]
244
+ chord_set.name.should == :Am
245
+ end
246
+ end
218
247
  end
219
248
  end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'ChordedNode' do
4
+ describe "value" do
5
+ it "should be the call names of the chord sets in the bar, if available" do
6
+ bar = Node::Bar.new(:children => [Node::ChordSet.new(:name => :Am, :value => 'r-"Am"')])
7
+
8
+ chorded_bar = Node::Bar::ChordedNode.new(:node => bar)
9
+ chorded_bar.value.should == '\cChordSetAm'
10
+ end
11
+
12
+ it "should be blank, if the bar does not have any chord sets" do
13
+ bar = Node::Bar.new(:children => [Node::NoteSet.new(:value => 'c')])
14
+
15
+ chorded_bar = Node::Bar::ChordedNode.new(:node => bar)
16
+ chorded_bar.value.should == ""
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'ChordedNode' do
4
+ describe "definition_name" do
5
+ it "should include the node's class and the node's name" do
6
+ chorded_node = Node::Base::ChordedNode.new(:node => Node::Base.new(:name => :Am))
7
+ chorded_node.definition_name.should == 'cBaseAm'
8
+ end
9
+ end
10
+
11
+ describe "value" do
12
+ it "should be the call names of its children" do
13
+ node = Node::Base.new(:children => [
14
+ Node::Base.new(:name => :First),
15
+ Node::Base.new(:name => :Second)
16
+ ])
17
+ chorded_node = Node::Base::ChordedNode.new(:node => node)
18
+ chorded_node.value.should == '\cBaseFirst \cBaseSecond'
19
+ end
20
+ end
21
+
22
+ describe "call_name" do
23
+ it "should be the call name of the voiced node's definition name" do
24
+ chorded_node = Node::Base::ChordedNode.new(:node => Node::Base.new(:name => :Am))
25
+ chorded_node.call_name.should == '\cBaseAm'
26
+ end
27
+ end
28
+ end
29
+
@@ -93,8 +93,16 @@ describe Node::Base do
93
93
  definition_bar.should be_definition
94
94
  end
95
95
 
96
- it "should be false if this node does not have children" do
96
+ it "should be true if the node has a value" do
97
+ chord_set = Node::ChordSet.new(:name => :Am, :value =>'r4-"Am" r r r')
98
+ chord_set.own_children.should be_empty
99
+ chord_set.should be_definition
100
+ end
101
+
102
+ it "should be false if this node does not have children and it does not have a value" do
97
103
  call_bar = Node::Bar.new(:name => 'Intro')
104
+ call_bar.own_children.should be_empty
105
+ call_bar.value.should be_nil
98
106
  call_bar.should_not be_definition
99
107
  end
100
108
  end
@@ -259,4 +267,12 @@ describe Node::Base do
259
267
  stanza.descendants(Node::Bar).should == [bar]
260
268
  end
261
269
  end
270
+
271
+ describe "chorded" do
272
+ it "should return the chorded version of the node" do
273
+ node = Node::ChordSet.new
274
+ chorded_node = node.chorded
275
+ chorded_node.node.should == node
276
+ end
277
+ end
262
278
  end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'ChordSet::ChordedNode' do
4
+ describe "value" do
5
+ it "should be the chord set's value" do
6
+ chorded_node = Node::ChordSet::ChordedNode.new(:node => Node::ChordSet.new(:name => :Am, :value => '4r-"Am" r r r'))
7
+ chorded_node.value.should == '4r-"Am" r r r'
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe Node::ChordSet do
4
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitara
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - George Mendoza
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-24 00:00:00 Z
18
+ date: 2012-02-26 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: active_support
@@ -202,9 +202,13 @@ files:
202
202
  - lib/gitara/dsl.rb
203
203
  - lib/gitara/dsl_macros.rb
204
204
  - lib/gitara/node/bar.rb
205
+ - lib/gitara/node/bar/chorded_node.rb
205
206
  - lib/gitara/node/bar/voiced_node.rb
206
207
  - lib/gitara/node/base.rb
208
+ - lib/gitara/node/base/chorded_node.rb
207
209
  - lib/gitara/node/base/voiced_node.rb
210
+ - lib/gitara/node/chord_set.rb
211
+ - lib/gitara/node/chord_set/chorded_node.rb
208
212
  - lib/gitara/node/line.rb
209
213
  - lib/gitara/node/note_set.rb
210
214
  - lib/gitara/node/score.rb
@@ -212,6 +216,7 @@ files:
212
216
  - lib/gitara/node/tab.rb
213
217
  - lib/gitara/pow/base.rb
214
218
  - lib/gitara/template/bar.erb
219
+ - lib/gitara/template/chord_set.erb
215
220
  - lib/gitara/template/line.erb
216
221
  - lib/gitara/template/score.erb
217
222
  - lib/gitara/template/stanza.erb
@@ -223,10 +228,14 @@ files:
223
228
  - lib/gitara/voice.rb
224
229
  - spec/lib/gitara/app_spec.rb
225
230
  - spec/lib/gitara/dsl_spec.rb
231
+ - spec/lib/gitara/node/bar/chorded_node_spec.rb
226
232
  - spec/lib/gitara/node/bar/voiced_node_spec.rb
227
233
  - spec/lib/gitara/node/bar_spec.rb
234
+ - spec/lib/gitara/node/base/chorded_node_spec.rb
228
235
  - spec/lib/gitara/node/base/voiced_node_spec.rb
229
236
  - spec/lib/gitara/node/base_spec.rb
237
+ - spec/lib/gitara/node/chord_set/chorded_node_spec.rb
238
+ - spec/lib/gitara/node/chord_set_spec.rb
230
239
  - spec/lib/gitara/node/note_set_spec.rb
231
240
  - spec/lib/gitara/node/stanza_spec.rb
232
241
  - spec/lib/gitara/node/tab_spec.rb