head_music 4.0.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/Rakefile +0 -2
- data/bin/console +0 -2
- data/head_music.gemspec +0 -2
- data/lib/head_music/{sign.rb → alteration.rb} +13 -15
- data/lib/head_music/chromatic_interval.rb +0 -2
- data/lib/head_music/circle.rb +0 -2
- data/lib/head_music/clef.rb +0 -2
- data/lib/head_music/consonance.rb +0 -2
- data/lib/head_music/content/bar.rb +0 -2
- data/lib/head_music/content/composition.rb +0 -2
- data/lib/head_music/content/note.rb +0 -2
- data/lib/head_music/content/placement.rb +0 -2
- data/lib/head_music/content/position.rb +0 -2
- data/lib/head_music/content/rhythmic_value.rb +0 -2
- data/lib/head_music/content/voice.rb +0 -2
- data/lib/head_music/data/instrument_families.yml +1 -1
- data/lib/head_music/data/instruments.yml +570 -522
- data/lib/head_music/diatonic_interval.rb +0 -2
- data/lib/head_music/harmonic_interval.rb +0 -2
- data/lib/head_music/instrument/pitch_configuration.rb +35 -0
- data/lib/head_music/instrument/staff.rb +30 -0
- data/lib/head_music/instrument/staff_configuration.rb +19 -0
- data/lib/head_music/instrument.rb +31 -19
- data/lib/head_music/interval_cycle.rb +0 -2
- data/lib/head_music/key_signature.rb +0 -2
- data/lib/head_music/letter_name.rb +0 -2
- data/lib/head_music/locales/en.yml +2 -1
- data/lib/head_music/melodic_interval.rb +0 -2
- data/lib/head_music/meter.rb +0 -2
- data/lib/head_music/motion.rb +0 -2
- data/lib/head_music/musical_symbol.rb +0 -2
- data/lib/head_music/named.rb +0 -2
- data/lib/head_music/pitch/enharmonic_equivalence.rb +0 -2
- data/lib/head_music/pitch/octave_equivalence.rb +0 -2
- data/lib/head_music/pitch.rb +7 -9
- data/lib/head_music/pitch_class.rb +0 -2
- data/lib/head_music/pitch_class_set.rb +0 -2
- data/lib/head_music/pitch_set.rb +0 -2
- data/lib/head_music/quality.rb +0 -2
- data/lib/head_music/reference_pitch.rb +0 -2
- data/lib/head_music/register.rb +0 -2
- data/lib/head_music/rhythm.rb +0 -2
- data/lib/head_music/rhythmic_unit.rb +0 -2
- data/lib/head_music/scale.rb +0 -2
- data/lib/head_music/scale_degree.rb +8 -10
- data/lib/head_music/scale_type.rb +0 -2
- data/lib/head_music/solmization.rb +0 -2
- data/lib/head_music/sonority.rb +0 -2
- data/lib/head_music/spelling.rb +18 -20
- data/lib/head_music/staff.rb +0 -2
- data/lib/head_music/style/analysis.rb +0 -2
- data/lib/head_music/style/annotation.rb +0 -2
- data/lib/head_music/style/guidelines/always_move.rb +0 -2
- data/lib/head_music/style/guidelines/approach_perfection_contrarily.rb +0 -2
- data/lib/head_music/style/guidelines/at_least_eight_notes.rb +0 -2
- data/lib/head_music/style/guidelines/avoid_crossing_voices.rb +0 -2
- data/lib/head_music/style/guidelines/avoid_overlapping_voices.rb +0 -2
- data/lib/head_music/style/guidelines/consonant_climax.rb +0 -2
- data/lib/head_music/style/guidelines/consonant_downbeats.rb +0 -2
- data/lib/head_music/style/guidelines/diatonic.rb +1 -3
- data/lib/head_music/style/guidelines/direction_changes.rb +0 -2
- data/lib/head_music/style/guidelines/end_on_perfect_consonance.rb +0 -2
- data/lib/head_music/style/guidelines/end_on_tonic.rb +0 -2
- data/lib/head_music/style/guidelines/frequent_direction_changes.rb +0 -2
- data/lib/head_music/style/guidelines/limit_octave_leaps.rb +0 -2
- data/lib/head_music/style/guidelines/moderate_direction_changes.rb +0 -2
- data/lib/head_music/style/guidelines/mostly_conjunct.rb +0 -2
- data/lib/head_music/style/guidelines/no_rests.rb +0 -2
- data/lib/head_music/style/guidelines/no_unisons_in_middle.rb +0 -2
- data/lib/head_music/style/guidelines/notes_same_length.rb +0 -2
- data/lib/head_music/style/guidelines/one_to_one.rb +0 -2
- data/lib/head_music/style/guidelines/prefer_contrary_motion.rb +0 -2
- data/lib/head_music/style/guidelines/prefer_imperfect.rb +0 -2
- data/lib/head_music/style/guidelines/prepare_octave_leaps.rb +0 -2
- data/lib/head_music/style/guidelines/recover_large_leaps.rb +0 -2
- data/lib/head_music/style/guidelines/singable_intervals.rb +0 -2
- data/lib/head_music/style/guidelines/singable_range.rb +0 -2
- data/lib/head_music/style/guidelines/single_large_leaps.rb +0 -2
- data/lib/head_music/style/guidelines/start_on_perfect_consonance.rb +0 -2
- data/lib/head_music/style/guidelines/start_on_tonic.rb +0 -2
- data/lib/head_music/style/guidelines/step_down_to_final_note.rb +0 -2
- data/lib/head_music/style/guidelines/step_out_of_unison.rb +0 -2
- data/lib/head_music/style/guidelines/step_to_final_note.rb +0 -2
- data/lib/head_music/style/guidelines/step_up_to_final_note.rb +0 -2
- data/lib/head_music/style/guidelines/up_to_fourteen_notes.rb +0 -2
- data/lib/head_music/style/guides/first_species_harmony.rb +0 -2
- data/lib/head_music/style/guides/first_species_melody.rb +0 -2
- data/lib/head_music/style/guides/fux_cantus_firmus.rb +0 -2
- data/lib/head_music/style/guides/modern_cantus_firmus.rb +0 -2
- data/lib/head_music/style/mark.rb +0 -2
- data/lib/head_music/tuning.rb +0 -2
- data/lib/head_music/utilities/hash_key.rb +0 -2
- data/lib/head_music/version.rb +1 -3
- data/lib/head_music.rb +4 -3
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4225259e4cfbb1eac6257f4840b10731b58d1a09b52b87677e00522fdb2a7351
|
4
|
+
data.tar.gz: 92e620b782cb6a7e424e97b98d7eeb50b130b11f11293b494274dc382a0ac62d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a41a9bf9e1e724990819ad1f9ed93889a5433f80407426250d7cef27248d69155f46db4838fd7cfd99b5bdeb680b40ce5a8c00acdcffd76a1260dbe7ce300c6
|
7
|
+
data.tar.gz: 1b6053743fb591e4cf8428faf09732ce2ab1c271cc37759b732cf36fb9b6021adc26ec4c444312beb98d01c3d68ecdb9db97b13efa8dc9c8040f5b31f35b9973
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/head_music.gemspec
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
require "head_music/musical_symbol"
|
4
2
|
|
5
|
-
# A
|
3
|
+
# A Alteration is a symbol that modifies pitch, such as a sharp, flat, or natural.
|
6
4
|
# In French, sharps and flats in the key signature are called "altérations".
|
7
|
-
class HeadMusic::
|
5
|
+
class HeadMusic::Alteration
|
8
6
|
include Comparable
|
9
7
|
|
10
8
|
attr_reader :identifier, :cents, :musical_symbols
|
11
9
|
|
12
10
|
delegate :ascii, :unicode, :html_entity, to: :musical_symbol
|
13
11
|
|
14
|
-
|
12
|
+
ALTERATION_RECORDS = [
|
15
13
|
{
|
16
14
|
identifier: :sharp, cents: 100,
|
17
15
|
symbols: [{ascii: "#", unicode: "♯", html_entity: "♯"}]
|
@@ -34,14 +32,14 @@ class HeadMusic::Sign
|
|
34
32
|
}
|
35
33
|
].freeze
|
36
34
|
|
37
|
-
|
35
|
+
ALTERATION_IDENTIFIERS = ALTERATION_RECORDS.map { |attributes| attributes[:identifier] }.freeze
|
38
36
|
|
39
37
|
def self.all
|
40
|
-
|
38
|
+
ALTERATION_RECORDS.map { |attributes| new(attributes) }
|
41
39
|
end
|
42
40
|
|
43
41
|
def self.symbols
|
44
|
-
@symbols ||= all.map { |
|
42
|
+
@symbols ||= all.map { |alteration| [alteration.ascii, alteration.unicode] }.flatten.reject { |s| s.nil? || s.empty? }
|
45
43
|
end
|
46
44
|
|
47
45
|
def self.matcher
|
@@ -53,16 +51,16 @@ class HeadMusic::Sign
|
|
53
51
|
end
|
54
52
|
|
55
53
|
def self.get(identifier)
|
56
|
-
return identifier if identifier.is_a?(HeadMusic::
|
54
|
+
return identifier if identifier.is_a?(HeadMusic::Alteration)
|
57
55
|
|
58
|
-
all.detect do |
|
59
|
-
|
56
|
+
all.detect do |alteration|
|
57
|
+
alteration.representions.include?(identifier)
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
63
61
|
def self.by(key, value)
|
64
|
-
all.detect do |
|
65
|
-
|
62
|
+
all.detect do |alteration|
|
63
|
+
alteration.send(key) == value if %i[cents semitones].include?(key.to_sym)
|
66
64
|
end
|
67
65
|
end
|
68
66
|
|
@@ -79,7 +77,7 @@ class HeadMusic::Sign
|
|
79
77
|
cents / 100.0
|
80
78
|
end
|
81
79
|
|
82
|
-
|
80
|
+
ALTERATION_IDENTIFIERS.each do |key|
|
83
81
|
define_method(:"#{key}?") { identifier == key }
|
84
82
|
end
|
85
83
|
|
@@ -88,7 +86,7 @@ class HeadMusic::Sign
|
|
88
86
|
end
|
89
87
|
|
90
88
|
def <=>(other)
|
91
|
-
other = HeadMusic::
|
89
|
+
other = HeadMusic::Alteration.get(other)
|
92
90
|
cents <=> other.cents
|
93
91
|
end
|
94
92
|
|
data/lib/head_music/circle.rb
CHANGED
data/lib/head_music/clef.rb
CHANGED