gitara 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +5 -0
- data/README.markdown +26 -2
- data/examples/aimee-man-wise-up/aimee-man-wise-up.ly +17 -2
- data/examples/aimee-man-wise-up/aimee-man-wise-up.midi +0 -0
- data/examples/aimee-man-wise-up/aimee-man-wise-up.pdf +0 -0
- data/examples/aimee-man-wise-up/aimee-man-wise-up.rb +8 -0
- data/examples/tab.ly +17 -2
- data/examples/tab.rb +8 -0
- data/lib/gitara/dsl.rb +12 -0
- data/lib/gitara/dsl_macros.rb +9 -0
- data/lib/gitara/node/tab.rb +8 -0
- data/lib/gitara/template/tab.erb +10 -3
- data/lib/gitara/template/tab_tempo.erb +3 -0
- data/lib/gitara/template/voice.erb +6 -1
- data/lib/gitara/version.rb +1 -1
- data/lib/gitara/voice.rb +8 -0
- data/spec/lib/gitara/dsl_spec.rb +13 -0
- data/spec/lib/gitara/node/tab_spec.rb +7 -0
- data/spec/lib/gitara/voice_spec.rb +54 -0
- metadata +6 -4
data/CHANGELOG.markdown
CHANGED
data/README.markdown
CHANGED
@@ -48,7 +48,7 @@ Bars are the smallest expressions in Gitara, that is, a gitara file must have at
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
With Gitara, it's easier to write notes using [absolute note names](http://lilypond.org/doc/v2.12/Documentation/
|
51
|
+
With Gitara, it's easier to write notes using [absolute note names](http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Writing-pitches#Absolute-octave-entry) instead of relative note names. This is because we'll be reusing bars and other Gitara expressions (see Reusing bars below).
|
52
52
|
|
53
53
|
|
54
54
|
Multiple voices
|
@@ -168,7 +168,7 @@ You can group bars in a line:
|
|
168
168
|
bar :BayangMagiliw, :PerlasNgSilanganan, :AlabNgPuso, :SaDibdibMoyBuhay
|
169
169
|
end
|
170
170
|
|
171
|
-
Lines are manually breaked with [\\break](http://lilypond.org/doc/v2.12/Documentation/
|
171
|
+
Lines are manually breaked with [\\break](http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Line-breaking).
|
172
172
|
|
173
173
|
Like bars, lines can be named, reused, etc.
|
174
174
|
|
@@ -179,6 +179,30 @@ Stanzas
|
|
179
179
|
The names of a stanza will be displayed at the top of the stanza's first bar.
|
180
180
|
|
181
181
|
|
182
|
+
Properties
|
183
|
+
----------
|
184
|
+
|
185
|
+
A gitara file can have the following optional properties:
|
186
|
+
|
187
|
+
Gitara.define do
|
188
|
+
title "Wise Up"
|
189
|
+
composer "Aimee Mann"
|
190
|
+
arranger "Arranged by George Mendoza"
|
191
|
+
instrument "Guitar (capo on second fret)"
|
192
|
+
midi_instrument "acoustic guitar (nylon)"
|
193
|
+
tempo "4 = 75"
|
194
|
+
transposition "d"
|
195
|
+
end
|
196
|
+
|
197
|
+
* arranger - tab's arranger
|
198
|
+
* composer - song's composer
|
199
|
+
* instrument - description of the instrument used on the tab
|
200
|
+
* 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.
|
202
|
+
* title - title of the song
|
203
|
+
* 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
|
+
|
205
|
+
|
182
206
|
Notes with single quotes and backslashes
|
183
207
|
----------------------------------------
|
184
208
|
|
@@ -5,6 +5,13 @@
|
|
5
5
|
indent = #0
|
6
6
|
}
|
7
7
|
|
8
|
+
\header {
|
9
|
+
title = "Wise Up"
|
10
|
+
composer = "Aimee Mann"
|
11
|
+
arranger = "Arranged by George Mendoza"
|
12
|
+
instrument = "Guitar (capo on second fret)"
|
13
|
+
}
|
14
|
+
|
8
15
|
%-----------------------------------------------------------------------
|
9
16
|
% Bars
|
10
17
|
|
@@ -144,9 +151,15 @@ vTwoScoreTabOneScoreOne = { \vTwoStanzaIntro \vTwoStanzaVerseOne \vTwoStanzaChor
|
|
144
151
|
%-----------------------------------------------------------------------
|
145
152
|
% Voices
|
146
153
|
|
147
|
-
vOne = {
|
154
|
+
vOne = {
|
155
|
+
\transposition d''
|
156
|
+
\vOneScoreTabOneScoreOne
|
157
|
+
}
|
148
158
|
|
149
|
-
vTwo = {
|
159
|
+
vTwo = {
|
160
|
+
\transposition d'
|
161
|
+
\vTwoScoreTabOneScoreOne
|
162
|
+
}
|
150
163
|
|
151
164
|
|
152
165
|
%-----------------------------------------------------------------------
|
@@ -169,6 +182,7 @@ stanzaHeadings = {
|
|
169
182
|
\new StaffGroup <<
|
170
183
|
\new Staff <<
|
171
184
|
\tempo 4 = 75
|
185
|
+
|
172
186
|
\clef "treble_8"
|
173
187
|
|
174
188
|
\new Voice \with { \remove Rest_engraver } {
|
@@ -220,6 +234,7 @@ stanzaHeadings = {
|
|
220
234
|
\score {
|
221
235
|
\new Staff \with {midiInstrument = #"acoustic guitar (nylon)"} <<
|
222
236
|
\tempo 4 = 75
|
237
|
+
|
223
238
|
\clef "treble_8"
|
224
239
|
|
225
240
|
\new Voice {
|
Binary file
|
Binary file
|
@@ -1,4 +1,12 @@
|
|
1
1
|
Gitara.define do
|
2
|
+
title "Wise Up"
|
3
|
+
composer "Aimee Mann"
|
4
|
+
arranger "Arranged by George Mendoza"
|
5
|
+
instrument "Guitar (capo on second fret)"
|
6
|
+
midi_instrument "acoustic guitar (nylon)"
|
7
|
+
tempo "4 = 75"
|
8
|
+
transposition "d"
|
9
|
+
|
2
10
|
bar :BeforeYouSign do
|
3
11
|
notes "r8 <d'/2>16( <c'/2>8.) <a/3>16 <c'/2>8. <d'/2>16 <e'/1>8. <g/3>8"
|
4
12
|
notes "<d/4>4 <d/4>4 <d/4>4 <d/4>4"
|
data/examples/tab.ly
CHANGED
@@ -5,6 +5,13 @@
|
|
5
5
|
indent = #0
|
6
6
|
}
|
7
7
|
|
8
|
+
\header {
|
9
|
+
title = "Wise Up"
|
10
|
+
composer = "Aimee Mann"
|
11
|
+
arranger = "Arranged by George Mendoza"
|
12
|
+
instrument = "Guitar (capo on second fret)"
|
13
|
+
}
|
14
|
+
|
8
15
|
%-----------------------------------------------------------------------
|
9
16
|
% Bars
|
10
17
|
|
@@ -54,9 +61,15 @@ vTwoScoreTabOneScoreOne = { \vTwoStanzaVerseOne }
|
|
54
61
|
%-----------------------------------------------------------------------
|
55
62
|
% Voices
|
56
63
|
|
57
|
-
vOne = {
|
64
|
+
vOne = {
|
65
|
+
\transposition d''
|
66
|
+
\vOneScoreTabOneScoreOne
|
67
|
+
}
|
58
68
|
|
59
|
-
vTwo = {
|
69
|
+
vTwo = {
|
70
|
+
\transposition d'
|
71
|
+
\vTwoScoreTabOneScoreOne
|
72
|
+
}
|
60
73
|
|
61
74
|
|
62
75
|
%-----------------------------------------------------------------------
|
@@ -72,6 +85,7 @@ stanzaHeadings = {
|
|
72
85
|
\new StaffGroup <<
|
73
86
|
\new Staff <<
|
74
87
|
\tempo 4 = 75
|
88
|
+
|
75
89
|
\clef "treble_8"
|
76
90
|
|
77
91
|
\new Voice \with { \remove Rest_engraver } {
|
@@ -123,6 +137,7 @@ stanzaHeadings = {
|
|
123
137
|
\score {
|
124
138
|
\new Staff \with {midiInstrument = #"acoustic guitar (nylon)"} <<
|
125
139
|
\tempo 4 = 75
|
140
|
+
|
126
141
|
\clef "treble_8"
|
127
142
|
|
128
143
|
\new Voice {
|
data/examples/tab.rb
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
Gitara.define do
|
2
|
+
title "Wise Up"
|
3
|
+
composer "Aimee Mann"
|
4
|
+
arranger "Arranged by George Mendoza"
|
5
|
+
instrument "Guitar (capo on second fret)"
|
6
|
+
midi_instrument "acoustic guitar (nylon)"
|
7
|
+
transposition "d"
|
8
|
+
tempo "4 = 75"
|
9
|
+
|
2
10
|
bar :BeganIt do
|
3
11
|
notes "/skip 4 <a/3 c'/2 >8 <g/3>8 /skip 4 <g/3 c'/2 >8 <g/3>8"
|
4
12
|
notes "<f/4>4 <f/4>4 <c/5>4 <e/4>4"
|
data/lib/gitara/dsl.rb
CHANGED
@@ -1,7 +1,19 @@
|
|
1
|
+
require "gitara/dsl_macros"
|
2
|
+
|
1
3
|
module Gitara
|
2
4
|
class Dsl < Valuable
|
5
|
+
extend DslMacros
|
6
|
+
|
3
7
|
has_value :node
|
4
8
|
|
9
|
+
can_add_property :arranger
|
10
|
+
can_add_property :composer
|
11
|
+
can_add_property :instrument
|
12
|
+
can_add_property :midi_instrument
|
13
|
+
can_add_property :tempo
|
14
|
+
can_add_property :title
|
15
|
+
can_add_property :transposition
|
16
|
+
|
5
17
|
def add(child, &block)
|
6
18
|
self.node.add child
|
7
19
|
Dsl.new(:node => child).instance_eval(&block) if block_given?
|
data/lib/gitara/node/tab.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
module Gitara
|
2
2
|
module Node
|
3
3
|
class Tab < Base
|
4
|
+
has_value :arranger
|
5
|
+
has_value :composer
|
6
|
+
has_value :instrument
|
7
|
+
has_value :midi_instrument, :default => "acoustic guitar (nylon)"
|
8
|
+
has_value :tempo
|
9
|
+
has_value :title
|
10
|
+
has_value :transposition
|
11
|
+
|
4
12
|
def self.parse(text)
|
5
13
|
Transform.new.apply(Parser.new.parse(text))
|
6
14
|
end
|
data/lib/gitara/template/tab.erb
CHANGED
@@ -5,6 +5,13 @@
|
|
5
5
|
indent = #0
|
6
6
|
}
|
7
7
|
|
8
|
+
\header {
|
9
|
+
title = "<%= self.title %>"
|
10
|
+
composer = "<%= self.composer %>"
|
11
|
+
arranger = "<%= self.arranger %>"
|
12
|
+
instrument = "<%= self.instrument %>"
|
13
|
+
}
|
14
|
+
|
8
15
|
%-----------------------------------------------------------------------
|
9
16
|
% Bars
|
10
17
|
|
@@ -54,7 +61,7 @@ stanzaHeadings = {
|
|
54
61
|
\score {
|
55
62
|
\new StaffGroup <<
|
56
63
|
\new Staff <<
|
57
|
-
|
64
|
+
<%= Gitara.render('tab_tempo', self) %>
|
58
65
|
\clef "treble_8"
|
59
66
|
|
60
67
|
\new Voice \with { \remove Rest_engraver } {
|
@@ -100,8 +107,8 @@ stanzaHeadings = {
|
|
100
107
|
|
101
108
|
% showLastLength = R1*4
|
102
109
|
\score {
|
103
|
-
\new Staff \with {midiInstrument = #"
|
104
|
-
|
110
|
+
\new Staff \with {midiInstrument = #"<%= self.midi_instrument %>"} <<
|
111
|
+
<%= Gitara.render('tab_tempo', self) %>
|
105
112
|
\clef "treble_8"
|
106
113
|
|
107
114
|
<% voices.each do |voice| %>
|
data/lib/gitara/version.rb
CHANGED
data/lib/gitara/voice.rb
CHANGED
@@ -15,8 +15,16 @@ module Gitara
|
|
15
15
|
Utilities.id_as_word(id)
|
16
16
|
end
|
17
17
|
|
18
|
+
def octave
|
19
|
+
(self.parent.max_number_of_voices - self.id) + 1
|
20
|
+
end
|
21
|
+
|
18
22
|
def stem_type
|
19
23
|
"\\voice#{id_as_word}"
|
20
24
|
end
|
25
|
+
|
26
|
+
def transposition
|
27
|
+
"#{self.parent.transposition}#{"'" * self.octave}" if self.parent.transposition
|
28
|
+
end
|
21
29
|
end
|
22
30
|
end
|
data/spec/lib/gitara/dsl_spec.rb
CHANGED
@@ -202,5 +202,18 @@ describe Gitara do
|
|
202
202
|
stanza.own_children[0].should == line
|
203
203
|
end
|
204
204
|
end
|
205
|
+
|
206
|
+
[:title, :composer, :arranger, :instrument, :midi_instrument, :tempo, :transposition].each do |property|
|
207
|
+
describe "#{property}(value)" do
|
208
|
+
it "should set the #{property} of the tab to value" do
|
209
|
+
tab =Node::Tab.new
|
210
|
+
|
211
|
+
dsl = Dsl.new(:node => tab)
|
212
|
+
dsl.send property, "test"
|
213
|
+
|
214
|
+
tab.send(property).should == "test"
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
205
218
|
end
|
206
219
|
end
|
@@ -54,4 +54,11 @@ describe 'Tab' do
|
|
54
54
|
tab.playable_child.id.should == 2
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
describe "midi_instrument" do
|
59
|
+
it "should have acoustic guitar (nylon) as default" do
|
60
|
+
tab = Node::Tab.new
|
61
|
+
tab.midi_instrument.should == 'acoustic guitar (nylon)'
|
62
|
+
end
|
63
|
+
end
|
57
64
|
end
|
@@ -28,4 +28,58 @@ describe Voice do
|
|
28
28
|
voice.stem_type.should == '\voiceOne'
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
describe "transposition" do
|
33
|
+
it "should be based on the tab's transposition and the voice's octave" do
|
34
|
+
tab = Node::Tab.new(
|
35
|
+
:transposition => 'd',
|
36
|
+
:children => [
|
37
|
+
Node::Bar.new(:children => [
|
38
|
+
Node::NoteSet.new,
|
39
|
+
Node::NoteSet.new
|
40
|
+
])
|
41
|
+
]
|
42
|
+
)
|
43
|
+
tab.max_number_of_voices.should == 2
|
44
|
+
|
45
|
+
voice = Voice.new(:parent => tab, :id => 1)
|
46
|
+
voice.transposition.should == "d''"
|
47
|
+
|
48
|
+
voice = Voice.new(:parent => tab, :id => 2)
|
49
|
+
voice.transposition.should == "d'"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should be blank if the tab has no transposition" do
|
53
|
+
tab = Node::Tab.new(
|
54
|
+
:children => [
|
55
|
+
Node::Bar.new(:children => [
|
56
|
+
Node::NoteSet.new,
|
57
|
+
Node::NoteSet.new
|
58
|
+
])
|
59
|
+
]
|
60
|
+
)
|
61
|
+
tab.max_number_of_voices.should == 2
|
62
|
+
|
63
|
+
voice = Voice.new(:parent => tab, :id => 1)
|
64
|
+
voice.transposition.should be_nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "octave" do
|
69
|
+
it "should be based on the voice's position in the tab" do
|
70
|
+
tab = Node::Tab.new(:children => [
|
71
|
+
Node::Bar.new(:children => [
|
72
|
+
Node::NoteSet.new,
|
73
|
+
Node::NoteSet.new
|
74
|
+
])
|
75
|
+
])
|
76
|
+
tab.max_number_of_voices.should == 2
|
77
|
+
|
78
|
+
voice = Voice.new(:parent => tab, :id => 1)
|
79
|
+
voice.octave.should == 2
|
80
|
+
|
81
|
+
voice = Voice.new(:parent => tab, :id => 2)
|
82
|
+
voice.octave.should == 1
|
83
|
+
end
|
84
|
+
end
|
31
85
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.3.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-
|
18
|
+
date: 2012-02-24 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: active_support
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/gitara.rb
|
201
201
|
- lib/gitara/app.rb
|
202
202
|
- lib/gitara/dsl.rb
|
203
|
+
- lib/gitara/dsl_macros.rb
|
203
204
|
- lib/gitara/node/bar.rb
|
204
205
|
- lib/gitara/node/bar/voiced_node.rb
|
205
206
|
- lib/gitara/node/base.rb
|
@@ -215,6 +216,7 @@ files:
|
|
215
216
|
- lib/gitara/template/score.erb
|
216
217
|
- lib/gitara/template/stanza.erb
|
217
218
|
- lib/gitara/template/tab.erb
|
219
|
+
- lib/gitara/template/tab_tempo.erb
|
218
220
|
- lib/gitara/template/voice.erb
|
219
221
|
- lib/gitara/utilities.rb
|
220
222
|
- lib/gitara/version.rb
|