Class: GuitarProParser::Note
- Inherits:
-
Object
- Object
- GuitarProParser::Note
- Defined in:
- lib/guitar_pro_parser/note.rb
Instance Attribute Summary collapse
-
#accentuated ⇒ Object
(Boolean) Is this note accentuated?.
-
#bend ⇒ Object
(Hash) Bend effect.
-
#dynamic ⇒ Object
Note dynamic.
-
#fingers ⇒ Object
(Hash) Left and right fingering.
-
#fret ⇒ Object
Fret.
-
#ghost ⇒ Object
(Boolean) Is this note a ghost note?.
-
#grace ⇒ Object
(Hash) Grace note.
-
#hammer_or_pull ⇒ Object
(Boolean) Has this note hammer on or pull off effect?.
-
#harmonic ⇒ Object
(Hash) Harmonic of the note.
-
#let_ring ⇒ Object
(Boolean) Has this note let ring effect?.
-
#palm_mute ⇒ Object
(Boolean) Has this note palm mute effect?.
-
#slide ⇒ Object
(Array) Slide effects.
-
#staccato ⇒ Object
(Boolean) Has this note stacatto effect?.
-
#time_independent_duration ⇒ Object
Time independent duration data from version 4 of the format.
-
#tremolo ⇒ Object
(Hash) Tremolo effect.
-
#trill ⇒ Object
(Hash) Trill effect.
-
#type ⇒ Object
Type of note: normal, tie or dead (see GuitarProHelper::NOTE_TYPES).
-
#vibrato ⇒ Object
(Boolean) Has this note vibrato effect?.
Instance Method Summary collapse
- #add_grace(fret, dynamic, transition, duration, dead, position) ⇒ Object
- #add_harmonic(type) ⇒ Object
- #add_left_hand_finger(finger) ⇒ Object
- #add_right_hand_finger(finger) ⇒ Object
- #add_tremolo(speed) ⇒ Object
- #add_trill(fret, period) ⇒ Object
-
#initialize ⇒ Note
constructor
A new instance of Note.
Constructor Details
#initialize ⇒ Note
Returns a new instance of Note.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/guitar_pro_parser/note.rb', line 91 def initialize @type = :normal @time_independent_duration = false @accentuated = false @ghost = false @dynamic = 'f' @fret = 0 @fingers = { left: nil, right: nil } @vibrato = false @grace = nil @let_ring = false @hammer_or_pull = false @trill = nil @bend = nil @staccato = false @palm_mute = false @harmonic = nil @tremolo = nil @slide = nil end |
Instance Attribute Details
#accentuated ⇒ Object
(Boolean) Is this note accentuated?
13 14 15 |
# File 'lib/guitar_pro_parser/note.rb', line 13 def accentuated @accentuated end |
#bend ⇒ Object
(Hash) Bend effect. E.g.:
{ type: :bend, # See GuitarProHelper::BEND_TYPES
height: 100, # Bend height. It is 100 per tone and goes by quarter tone.
points: # List of points used to display the bend
[
{ time: 0,
pitch_alteration: 0, # The same rules as for height
vibrato_type: :none }, # See GuitarProHelper::BEND_VIBRATO_TYPES
{ time: 60, pitch_alteration: 100, vibrato_type: :none }
]
}
nil by default
66 67 68 |
# File 'lib/guitar_pro_parser/note.rb', line 66 def bend @bend end |
#dynamic ⇒ Object
Note dynamic. Default is ‘f’ (see GuitarProHelper::NOTE_DYNAMICS)
19 20 21 |
# File 'lib/guitar_pro_parser/note.rb', line 19 def dynamic @dynamic end |
#fingers ⇒ Object
(Hash) Left and right fingering. E.g.:
{ left: :middle, right: :thumb }
See fingers in GuitarProHelper::FINGERS
27 28 29 |
# File 'lib/guitar_pro_parser/note.rb', line 27 def fingers @fingers end |
#fret ⇒ Object
Fret
22 23 24 |
# File 'lib/guitar_pro_parser/note.rb', line 22 def fret @fret end |
#ghost ⇒ Object
(Boolean) Is this note a ghost note?
16 17 18 |
# File 'lib/guitar_pro_parser/note.rb', line 16 def ghost @ghost end |
#grace ⇒ Object
(Hash) Grace note. E.g.:
{ fret: 2,
dynamic: 'ff',
transition: :hammer, # see GuitarProHelper::GRACE_NOTE_TRANSITION_TYPES
duration: 32, # see GuitarProHelper::GRACE_NOTE_DURATIONS
dead: false,
position: :before_the_beat # or :on_the_beat }
nil by default
40 41 42 |
# File 'lib/guitar_pro_parser/note.rb', line 40 def grace @grace end |
#hammer_or_pull ⇒ Object
(Boolean) Has this note hammer on or pull off effect?
46 47 48 |
# File 'lib/guitar_pro_parser/note.rb', line 46 def hammer_or_pull @hammer_or_pull end |
#harmonic ⇒ Object
(Hash) Harmonic of the note. E.g.:
{ type: :artificial}
Full list of harmonic types see in GuitarProHelper::HARMONIC_TYPES nil by default
78 79 80 |
# File 'lib/guitar_pro_parser/note.rb', line 78 def harmonic @harmonic end |
#let_ring ⇒ Object
(Boolean) Has this note let ring effect?
43 44 45 |
# File 'lib/guitar_pro_parser/note.rb', line 43 def let_ring @let_ring end |
#palm_mute ⇒ Object
(Boolean) Has this note palm mute effect?
72 73 74 |
# File 'lib/guitar_pro_parser/note.rb', line 72 def palm_mute @palm_mute end |
#slide ⇒ Object
(Array) Slide effects. List of slides see in GuitarProHelper::SLIDE_TYPES. This attribute is array because Guitar Pro 5 supports multiple slides per note like :slide_in_from_below and :slide_out_and_upwards at once. nil by default
89 90 91 |
# File 'lib/guitar_pro_parser/note.rb', line 89 def @slide end |
#staccato ⇒ Object
(Boolean) Has this note stacatto effect?
69 70 71 |
# File 'lib/guitar_pro_parser/note.rb', line 69 def staccato @staccato end |
#time_independent_duration ⇒ Object
Time independent duration data from version 4 of the format. TODO: It is parsed but I don’t know if it’s used correctly
10 11 12 |
# File 'lib/guitar_pro_parser/note.rb', line 10 def time_independent_duration @time_independent_duration end |
#tremolo ⇒ Object
(Hash) Tremolo effect. E.g.:
{ speed: 16 } # See GuitarProHelper::TREMOLO_PICKING_SPEEDS
nil by default
83 84 85 |
# File 'lib/guitar_pro_parser/note.rb', line 83 def tremolo @tremolo end |
#trill ⇒ Object
(Hash) Trill effect. E.g.:
{ fret: 7,
period: 16 # see GuitarProHelper::TRILL_PERIODS }
nil by default
52 53 54 |
# File 'lib/guitar_pro_parser/note.rb', line 52 def trill @trill end |
#type ⇒ Object
Type of note: normal, tie or dead (see GuitarProHelper::NOTE_TYPES)
6 7 8 |
# File 'lib/guitar_pro_parser/note.rb', line 6 def type @type end |
#vibrato ⇒ Object
(Boolean) Has this note vibrato effect?
30 31 32 |
# File 'lib/guitar_pro_parser/note.rb', line 30 def vibrato @vibrato end |
Instance Method Details
#add_grace(fret, dynamic, transition, duration, dead, position) ⇒ Object
120 121 122 |
# File 'lib/guitar_pro_parser/note.rb', line 120 def add_grace(fret, dynamic, transition, duration, dead, position) @grace = { fret: fret, dynamic: dynamic, transition: transition, duration: duration, dead: dead, position: position } end |
#add_harmonic(type) ⇒ Object
128 129 130 |
# File 'lib/guitar_pro_parser/note.rb', line 128 def add_harmonic(type) @harmonic = { type: type } end |
#add_left_hand_finger(finger) ⇒ Object
112 113 114 |
# File 'lib/guitar_pro_parser/note.rb', line 112 def add_left_hand_finger(finger) @fingers[:left] = finger end |
#add_right_hand_finger(finger) ⇒ Object
116 117 118 |
# File 'lib/guitar_pro_parser/note.rb', line 116 def add_right_hand_finger(finger) @fingers[:right] = finger end |
#add_tremolo(speed) ⇒ Object
124 125 126 |
# File 'lib/guitar_pro_parser/note.rb', line 124 def add_tremolo(speed) @tremolo = { speed: speed } end |
#add_trill(fret, period) ⇒ Object
132 133 134 |
# File 'lib/guitar_pro_parser/note.rb', line 132 def add_trill(fret, period) @trill = { fret: fret, period: period } end |