guitar_pro_parser 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +2 -4
- data/guitar_pro_parser.gemspec +1 -1
- data/lib/guitar_pro_parser/guitar_pro_helper.rb +5 -14
- data/lib/guitar_pro_parser/io/reader.rb +7 -3
- data/lib/guitar_pro_parser/note.rb +3 -1
- data/lib/guitar_pro_parser/version.rb +1 -1
- data/spec/lib/guitar_pro_parser/note_spec.rb +6 -6
- metadata +4 -4
data/README.md
CHANGED
@@ -19,10 +19,6 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
Require the library:
|
23
|
-
|
24
|
-
require 'guitar_pro_parser'
|
25
|
-
|
26
22
|
Read the file:
|
27
23
|
|
28
24
|
song = GuitarProParser.read_file('path_to_file')
|
@@ -70,3 +66,5 @@ Or install it yourself as:
|
|
70
66
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
71
67
|
4. Push to the branch (`git push origin my-new-feature`)
|
72
68
|
5. Create new Pull Request
|
69
|
+
|
70
|
+
If you have a tab that couldn't be read or is read incorrectly, please send it to immaculate.pine@gmail.com or create an issue on Github with description of bug.
|
data/guitar_pro_parser.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Alexander Borovykh"]
|
10
10
|
spec.email = ["immaculate.pine@gmail.com"]
|
11
11
|
spec.description = %q{Gem for reading Guitar Pro files}
|
12
|
-
spec.summary = %q{
|
12
|
+
spec.summary = %q{This gem allows to read Guitar Pro files. Now it supports Guitar Pro 4 and 5 files. Version 3 should work but is not tested at all.}
|
13
13
|
spec.homepage = "https://github.com/ImmaculatePine/guitar_pro_parser"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -47,7 +47,11 @@ module GuitarProHelper
|
|
47
47
|
TREMOLO_PICKING_SPEEDS = { '3' => 32, '2' => 16, '1' => 8 }
|
48
48
|
|
49
49
|
SLIDE_TYPES = [:no_slide, :shift_slide, :legato_slide, :slide_out_and_downwards, :slide_out_and_upwards, :slide_in_from_below, :slide_in_from_above]
|
50
|
-
MAP_SLIDE_TYPES_GP5 = { '0'=>0, '1'=>1, '2'=>2,
|
50
|
+
MAP_SLIDE_TYPES_GP5 = { '0'=>0, '1'=>1, '2'=>2,
|
51
|
+
'4'=>3, '8'=>4, '16'=>5,
|
52
|
+
'17'=>[1, 5], '18'=>[2, 5], '20'=>[5, 3],
|
53
|
+
'24'=>[5, 4], '32'=>6, '33'=>[1, 6],
|
54
|
+
'34'=>[2, 6] ,'36'=>[6, 3], '40'=>[6,4] }
|
51
55
|
MAP_SLIDE_TYPES_GP4 = { '-2'=>6, '-1'=>5, '0'=>0, '1'=>1, '2'=>2, '3'=>3, '4'=>4 }
|
52
56
|
|
53
57
|
HARMONIC_TYPES = [:none, :natural, :artificial, :tapped, :pinch, :semi]
|
@@ -66,19 +70,6 @@ module GuitarProHelper
|
|
66
70
|
CHORD_TONALITIES = [:perfect, :diminished, :augmented]
|
67
71
|
|
68
72
|
|
69
|
-
# Macros to create boolean instance variables' getters like this:
|
70
|
-
# attr_boolean :complete
|
71
|
-
# generates
|
72
|
-
# complete?
|
73
|
-
# method that returns @complete instance variable
|
74
|
-
def attr_boolean(*variables)
|
75
|
-
variables.each do |variable|
|
76
|
-
define_method("#{variable}?") do
|
77
|
-
instance_variable_get("@#{variable}")
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
73
|
# Converts note's digit representation to its string equivalent:
|
83
74
|
# 0 for C0, 1 for C#0, etc.
|
84
75
|
def GuitarProHelper.digit_to_note(digit)
|
@@ -683,7 +683,7 @@ module GuitarProParser
|
|
683
683
|
@input.skip_short_integer if @version < 5.0 && note.time_independent_duration
|
684
684
|
|
685
685
|
note.dynamic = GuitarProHelper::NOTE_DYNAMICS.fetch(@input.read_byte - 1) if has_dynamic
|
686
|
-
note.fret = @input.read_byte
|
686
|
+
note.fret = @input.read_byte if has_type
|
687
687
|
|
688
688
|
if has_fingering
|
689
689
|
left_finger = @input.read_signed_byte
|
@@ -753,11 +753,15 @@ module GuitarProParser
|
|
753
753
|
|
754
754
|
if has_slide
|
755
755
|
value = @input.read_signed_byte.to_s
|
756
|
+
slides = []
|
757
|
+
|
756
758
|
if @version >= 5.0
|
757
|
-
|
759
|
+
slides = *GuitarProHelper::MAP_SLIDE_TYPES_GP5.fetch(value)
|
758
760
|
else
|
759
|
-
|
761
|
+
slides = *GuitarProHelper::MAP_SLIDE_TYPES_GP4.fetch(value)
|
760
762
|
end
|
763
|
+
|
764
|
+
note.slide = slides.map { |item| GuitarProHelper::SLIDE_TYPES.fetch(item) }
|
761
765
|
end
|
762
766
|
|
763
767
|
read_harmonic(note) if has_harmonic
|
@@ -82,7 +82,9 @@ module GuitarProParser
|
|
82
82
|
# nil by default
|
83
83
|
attr_accessor :tremolo
|
84
84
|
|
85
|
-
# Slide
|
85
|
+
# (Array) Slide effects. List of slides see in GuitarProHelper::SLIDE_TYPES.
|
86
|
+
# This attribute is array because Guitar Pro 5 supports multiple slides per note
|
87
|
+
# like :slide_in_from_below and :slide_out_and_upwards at once.
|
86
88
|
# nil by default
|
87
89
|
attr_accessor :slide
|
88
90
|
|
@@ -49,32 +49,32 @@ describe GuitarProParser::Note do
|
|
49
49
|
|
50
50
|
context 'legato slide' do
|
51
51
|
test_note :legato_slide
|
52
|
-
its(:slide) { should == :legato_slide }
|
52
|
+
its(:slide) { should == [:legato_slide] }
|
53
53
|
end
|
54
54
|
|
55
55
|
context 'shift slide' do
|
56
56
|
test_note :shift_slide
|
57
|
-
its(:slide) { should == :shift_slide }
|
57
|
+
its(:slide) { should == [:shift_slide] }
|
58
58
|
end
|
59
59
|
|
60
60
|
context 'slide in from below' do
|
61
61
|
test_note :slide_in_from_below
|
62
|
-
its(:slide) { should == :slide_in_from_below }
|
62
|
+
its(:slide) { should == [:slide_in_from_below] }
|
63
63
|
end
|
64
64
|
|
65
65
|
context 'slide in from above' do
|
66
66
|
test_note :slide_in_from_above
|
67
|
-
its(:slide) { should == :slide_in_from_above }
|
67
|
+
its(:slide) { should == [:slide_in_from_above] }
|
68
68
|
end
|
69
69
|
|
70
70
|
context 'slide out and downwards' do
|
71
71
|
test_note :slide_out_and_downwards
|
72
|
-
its(:slide) { should == :slide_out_and_downwards }
|
72
|
+
its(:slide) { should == [:slide_out_and_downwards] }
|
73
73
|
end
|
74
74
|
|
75
75
|
context 'slide out and upwards' do
|
76
76
|
test_note :slide_out_and_upwards
|
77
|
-
its(:slide) { should == :slide_out_and_upwards }
|
77
|
+
its(:slide) { should == [:slide_out_and_upwards] }
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
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.4
|
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-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -126,8 +126,8 @@ rubyforge_project:
|
|
126
126
|
rubygems_version: 1.8.25
|
127
127
|
signing_key:
|
128
128
|
specification_version: 3
|
129
|
-
summary:
|
130
|
-
|
129
|
+
summary: This gem allows to read Guitar Pro files. Now it supports Guitar Pro 4 and
|
130
|
+
5 files. Version 3 should work but is not tested at all.
|
131
131
|
test_files:
|
132
132
|
- spec/lib/guitar_pro_parser/bar_settings_spec.rb
|
133
133
|
- spec/lib/guitar_pro_parser/beat_spec.rb
|