guitar_pro_parser 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,7 @@ module GuitarProHelper
|
|
12
12
|
'FICHIER GUITAR PRO v4.00' => 4.0,
|
13
13
|
'FICHIER GUITAR PRO v4.06' => 4.06,
|
14
14
|
'FICHIER GUITAR PRO L4.06' => 4.06,
|
15
|
+
'FICHIER GUITAR PRO v5.00' => 5.0,
|
15
16
|
'FICHIER GUITAR PRO v5.10' => 5.1 }
|
16
17
|
|
17
18
|
NOTES = %w(C C# D D# E F F# G G# A A# B)
|
@@ -17,12 +17,12 @@ module GuitarProParser
|
|
17
17
|
@song.triplet_feel = @input.read_boolean if @version < 5.0
|
18
18
|
read_lyrics if @version >= 4.0
|
19
19
|
|
20
|
-
if @version
|
20
|
+
if @version > 5.0
|
21
21
|
@song.master_volume = @input.read_integer
|
22
22
|
@input.skip_integer
|
23
|
+
11.times { |n| @song.equalizer[n] = @input.read_byte }
|
23
24
|
end
|
24
|
-
|
25
|
-
11.times { |n| @song.equalizer[n] = @input.read_byte } if @version >= 5.0
|
25
|
+
|
26
26
|
read_page_setup if @version >= 5.0
|
27
27
|
read_tempo
|
28
28
|
read_key
|
@@ -82,7 +82,7 @@ module GuitarProParser
|
|
82
82
|
@song.subtitle = @input.read_chunk
|
83
83
|
@song.artist = @input.read_chunk
|
84
84
|
@song.album = @input.read_chunk
|
85
|
-
@song.lyricist = @input.read_chunk if @version
|
85
|
+
@song.lyricist = @input.read_chunk if @version >= 5.0
|
86
86
|
@song.composer = @input.read_chunk
|
87
87
|
@song.copyright = @input.read_chunk
|
88
88
|
@song.transcriber = @input.read_chunk
|
@@ -159,7 +159,7 @@ module GuitarProParser
|
|
159
159
|
def read_tempo
|
160
160
|
@song.tempo = @input.read_chunk if @version >= 5.0
|
161
161
|
@song.bpm = @input.read_integer
|
162
|
-
@input.skip_byte if @version
|
162
|
+
@input.skip_byte if @version > 5.0
|
163
163
|
end
|
164
164
|
|
165
165
|
def read_key
|
@@ -2,24 +2,89 @@ module GuitarProParser
|
|
2
2
|
|
3
3
|
class Note
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
5
|
+
# Type of note: normal, tie or dead (see GuitarProHelper::NOTE_TYPES)
|
6
|
+
attr_accessor :type
|
7
|
+
|
8
|
+
# Time independent duration data from version 4 of the format.
|
9
|
+
# TODO: It is parsed but I don't know if it's used correctly
|
10
|
+
attr_accessor :time_independent_duration
|
11
|
+
|
12
|
+
# (Boolean) Is this note accentuated?
|
13
|
+
attr_accessor :accentuated
|
14
|
+
|
15
|
+
# (Boolean) Is this note a ghost note?
|
16
|
+
attr_accessor :ghost
|
17
|
+
|
18
|
+
# Note dynamic. Default is 'f' (see GuitarProHelper::NOTE_DYNAMICS)
|
19
|
+
attr_accessor :dynamic
|
20
|
+
|
21
|
+
# Fret
|
22
|
+
attr_accessor :fret
|
23
|
+
|
24
|
+
# (Hash) Left and right fingering. E.g.:
|
25
|
+
# { left: :middle, right: :thumb }
|
26
|
+
# See fingers in GuitarProHelper::FINGERS
|
27
|
+
attr_accessor :fingers
|
28
|
+
|
29
|
+
# (Boolean) Has this note vibrato effect?
|
30
|
+
attr_accessor :vibrato
|
31
|
+
|
32
|
+
# (Hash) Grace note. E.g.:
|
33
|
+
# { fret: 2,
|
34
|
+
# dynamic: 'ff',
|
35
|
+
# transition: :hammer, # see GuitarProHelper::GRACE_NOTE_TRANSITION_TYPES
|
36
|
+
# duration: 32, # see GuitarProHelper::GRACE_NOTE_DURATIONS
|
37
|
+
# dead: false,
|
38
|
+
# position: :before_the_beat # or :on_the_beat }
|
39
|
+
# nil by default
|
40
|
+
attr_accessor :grace
|
41
|
+
|
42
|
+
# (Boolean) Has this note let ring effect?
|
43
|
+
attr_accessor :let_ring
|
44
|
+
|
45
|
+
# (Boolean) Has this note hammer on or pull off effect?
|
46
|
+
attr_accessor :hammer_or_pull
|
47
|
+
|
48
|
+
# (Hash) Trill effect. E.g.:
|
49
|
+
# { fret: 7,
|
50
|
+
# period: 16 # see GuitarProHelper::TRILL_PERIODS }
|
51
|
+
# nil by default
|
52
|
+
attr_accessor :trill
|
53
|
+
|
54
|
+
# (Hash) Bend effect. E.g.:
|
55
|
+
# { type: :bend, # See GuitarProHelper::BEND_TYPES
|
56
|
+
# height: 100, # Bend height. It is 100 per tone and goes by quarter tone.
|
57
|
+
# points: # List of points used to display the bend
|
58
|
+
# [
|
59
|
+
# { time: 0,
|
60
|
+
# pitch_alteration: 0, # The same rules as for height
|
61
|
+
# vibrato_type: :none }, # See GuitarProHelper::BEND_VIBRATO_TYPES
|
62
|
+
# { time: 60, pitch_alteration: 100, vibrato_type: :none }
|
63
|
+
# ]
|
64
|
+
# }
|
65
|
+
# nil by default
|
66
|
+
attr_accessor :bend
|
67
|
+
|
68
|
+
# (Boolean) Has this note stacatto effect?
|
69
|
+
attr_accessor :staccato
|
70
|
+
|
71
|
+
# (Boolean) Has this note palm mute effect?
|
72
|
+
attr_accessor :palm_mute
|
73
|
+
|
74
|
+
# (Hash) Harmonic of the note. E.g.:
|
75
|
+
# { type: :artificial}
|
76
|
+
# Full list of harmonic types see in GuitarProHelper::HARMONIC_TYPES
|
77
|
+
# nil by default
|
78
|
+
attr_accessor :harmonic
|
79
|
+
|
80
|
+
# (Hash) Tremolo effect. E.g.:
|
81
|
+
# { speed: 16 } # See GuitarProHelper::TREMOLO_PICKING_SPEEDS
|
82
|
+
# nil by default
|
83
|
+
attr_accessor :tremolo
|
84
|
+
|
85
|
+
# Slide effect. List of slides see in GuitarProHelper::SLIDE_TYPES
|
86
|
+
# nil by default
|
87
|
+
attr_accessor :slide
|
23
88
|
|
24
89
|
def initialize
|
25
90
|
@type = :normal
|
@@ -29,7 +94,6 @@ module GuitarProParser
|
|
29
94
|
@dynamic = 'f'
|
30
95
|
@fret = 0
|
31
96
|
@fingers = { left: nil, right: nil }
|
32
|
-
|
33
97
|
@vibrato = false
|
34
98
|
@grace = nil
|
35
99
|
@let_ring = false
|
@@ -10,7 +10,7 @@ describe GuitarProParser::Song do
|
|
10
10
|
its(:copyright) { should == 'Copyright' }
|
11
11
|
its(:transcriber) { should == 'Transcriber' }
|
12
12
|
its(:instructions) { should == 'Instructions' }
|
13
|
-
its(:notices) { should
|
13
|
+
its(:notices) { should == 'Notice 1/nNotice 2/nNotice 3' }
|
14
14
|
its(:master_volume) { should == 100 }
|
15
15
|
its(:tempo) { should == 'Moderate' }
|
16
16
|
its(:bpm) { should == 120 }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guitar_pro_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|