Module: WTFChord
- Defined in:
- lib/wtf_chord.rb,
lib/wtf_chord/cli.rb,
lib/wtf_chord/note.rb,
lib/wtf_chord/chord.rb,
lib/wtf_chord/pitch.rb,
lib/wtf_chord/rules.rb,
lib/wtf_chord/scale.rb,
lib/wtf_chord/version.rb,
lib/wtf_chord/keyboard.rb,
lib/wtf_chord/fingering.rb,
lib/wtf_chord/formatter.rb,
lib/wtf_chord/fretboard.rb,
lib/wtf_chord/piano_key.rb,
lib/wtf_chord/collectors.rb,
lib/wtf_chord/guitar_string.rb,
lib/wtf_chord/formatters/base.rb,
lib/wtf_chord/collectors/piano.rb,
lib/wtf_chord/formatters/piano.rb,
lib/wtf_chord/instrument_pitch.rb,
lib/wtf_chord/collectors/guitar.rb,
lib/wtf_chord/formatters/piano1.rb,
lib/wtf_chord/formatters/simple.rb,
lib/wtf_chord/collectors/generic.rb,
lib/wtf_chord/complexity_counter.rb,
lib/wtf_chord/formatters/default.rb,
lib/wtf_chord/keyboard_presentation.rb,
lib/wtf_chord/helpers/roman_numbers_helper.rb
Defined Under Namespace
Modules: Collectors, Formatters, RomanNumbersHelper
Classes: CLI, Chord, ComplexityCounter, Fingering, Formatter, Fretboard, GuitarString, InstrumentPitch, Keyboard, KeyboardPresentation, Note, PianoKey, Pitch, Rules
Constant Summary
collapse
- DEFAULTS =
{
:rules_file => File.expand_path("../wtf_chord.yml", __FILE__)
}.freeze
- DIATONIC =
{
"C" => "Do",
"D" => "Re",
"E" => "Mi",
"F" => "Fa",
"G" => "Sol",
"A" => "La",
"B" => "Si",
"H" => "Si"
}
- VERSION =
"0.7.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.rules ⇒ Object
Returns the value of attribute rules.
16
17
18
|
# File 'lib/wtf_chord.rb', line 16
def rules
@rules
end
|
Class Method Details
.chord(name) ⇒ Object
37
38
39
40
41
|
# File 'lib/wtf_chord/rules.rb', line 37
def self.chord(name)
name.match /^(?<note>[A-H][b#]?)(?<name>.+)?$/ do |m|
Chord.new(m[:note], m[:name])
end
end
|
.config {|_self| ... } ⇒ Object
18
19
20
|
# File 'lib/wtf_chord.rb', line 18
def config
yield(self)
end
|
.guitar ⇒ Object
72
73
74
|
# File 'lib/wtf_chord/scale.rb', line 72
def self.guitar
Thread.current[:wtf_guitar] ||= Fretboard.new(*%w(E2 A2 D3 G3 B3 E4))
end
|
.guitar=(guitar) ⇒ Object
68
69
70
|
# File 'lib/wtf_chord/scale.rb', line 68
def self.guitar=(guitar)
Thread.current[:wtf_guitar] = guitar
end
|
.note(val) ⇒ Object
80
81
82
83
84
85
86
|
# File 'lib/wtf_chord/pitch.rb', line 80
def self.note(val)
case val
when String
key, octave = val.scanf(NOTE_FSTR)
SCALE[key][octave || 4] if key
end
end
|
.piano ⇒ Object
80
81
82
|
# File 'lib/wtf_chord/scale.rb', line 80
def self.piano
Thread.current[:wtf_piano] ||= Keyboard.new
end
|
.piano=(piano) ⇒ Object
76
77
78
|
# File 'lib/wtf_chord/scale.rb', line 76
def self.piano=(piano)
Thread.current[:wtf_piano] = piano
end
|
.rules_file=(value) ⇒ Object
22
23
24
|
# File 'lib/wtf_chord.rb', line 22
def rules_file= value
self.rules = Rules.new(File.expand_path(value))
end
|