head_music 4.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -2
  3. data/Rakefile +0 -2
  4. data/bin/console +0 -2
  5. data/head_music.gemspec +0 -2
  6. data/lib/head_music/{sign.rb → alteration.rb} +13 -15
  7. data/lib/head_music/chromatic_interval.rb +0 -2
  8. data/lib/head_music/circle.rb +0 -2
  9. data/lib/head_music/clef.rb +0 -2
  10. data/lib/head_music/consonance.rb +0 -2
  11. data/lib/head_music/content/bar.rb +0 -2
  12. data/lib/head_music/content/composition.rb +0 -2
  13. data/lib/head_music/content/note.rb +0 -2
  14. data/lib/head_music/content/placement.rb +0 -2
  15. data/lib/head_music/content/position.rb +0 -2
  16. data/lib/head_music/content/rhythmic_value.rb +0 -2
  17. data/lib/head_music/content/voice.rb +0 -2
  18. data/lib/head_music/data/instrument_families.yml +2 -2
  19. data/lib/head_music/data/instruments.yml +571 -523
  20. data/lib/head_music/diatonic_interval.rb +0 -2
  21. data/lib/head_music/harmonic_interval.rb +0 -2
  22. data/lib/head_music/instrument/pitch_configuration.rb +35 -0
  23. data/lib/head_music/instrument/staff.rb +30 -0
  24. data/lib/head_music/instrument/staff_configuration.rb +19 -0
  25. data/lib/head_music/instrument.rb +31 -19
  26. data/lib/head_music/interval_cycle.rb +0 -2
  27. data/lib/head_music/key_signature.rb +0 -2
  28. data/lib/head_music/letter_name.rb +0 -2
  29. data/lib/head_music/locales/de.yml +1 -1
  30. data/lib/head_music/locales/en.yml +4 -3
  31. data/lib/head_music/locales/es.yml +1 -1
  32. data/lib/head_music/locales/fr.yml +1 -1
  33. data/lib/head_music/locales/it.yml +1 -1
  34. data/lib/head_music/locales/ru.yml +1 -1
  35. data/lib/head_music/melodic_interval.rb +0 -2
  36. data/lib/head_music/meter.rb +0 -2
  37. data/lib/head_music/motion.rb +0 -2
  38. data/lib/head_music/musical_symbol.rb +0 -2
  39. data/lib/head_music/named.rb +0 -2
  40. data/lib/head_music/pitch/enharmonic_equivalence.rb +0 -2
  41. data/lib/head_music/pitch/octave_equivalence.rb +0 -2
  42. data/lib/head_music/pitch.rb +7 -9
  43. data/lib/head_music/pitch_class.rb +0 -2
  44. data/lib/head_music/pitch_class_set.rb +0 -2
  45. data/lib/head_music/pitch_set.rb +0 -2
  46. data/lib/head_music/quality.rb +0 -2
  47. data/lib/head_music/reference_pitch.rb +0 -2
  48. data/lib/head_music/register.rb +0 -2
  49. data/lib/head_music/rhythm.rb +0 -2
  50. data/lib/head_music/rhythmic_unit.rb +0 -2
  51. data/lib/head_music/scale.rb +0 -2
  52. data/lib/head_music/scale_degree.rb +8 -10
  53. data/lib/head_music/scale_type.rb +0 -2
  54. data/lib/head_music/solmization.rb +0 -2
  55. data/lib/head_music/sonority.rb +0 -2
  56. data/lib/head_music/spelling.rb +18 -20
  57. data/lib/head_music/staff.rb +0 -2
  58. data/lib/head_music/style/analysis.rb +0 -2
  59. data/lib/head_music/style/annotation.rb +0 -2
  60. data/lib/head_music/style/guidelines/always_move.rb +0 -2
  61. data/lib/head_music/style/guidelines/approach_perfection_contrarily.rb +0 -2
  62. data/lib/head_music/style/guidelines/at_least_eight_notes.rb +0 -2
  63. data/lib/head_music/style/guidelines/avoid_crossing_voices.rb +0 -2
  64. data/lib/head_music/style/guidelines/avoid_overlapping_voices.rb +0 -2
  65. data/lib/head_music/style/guidelines/consonant_climax.rb +0 -2
  66. data/lib/head_music/style/guidelines/consonant_downbeats.rb +0 -2
  67. data/lib/head_music/style/guidelines/diatonic.rb +1 -3
  68. data/lib/head_music/style/guidelines/direction_changes.rb +0 -2
  69. data/lib/head_music/style/guidelines/end_on_perfect_consonance.rb +0 -2
  70. data/lib/head_music/style/guidelines/end_on_tonic.rb +0 -2
  71. data/lib/head_music/style/guidelines/frequent_direction_changes.rb +0 -2
  72. data/lib/head_music/style/guidelines/limit_octave_leaps.rb +0 -2
  73. data/lib/head_music/style/guidelines/moderate_direction_changes.rb +0 -2
  74. data/lib/head_music/style/guidelines/mostly_conjunct.rb +0 -2
  75. data/lib/head_music/style/guidelines/no_rests.rb +0 -2
  76. data/lib/head_music/style/guidelines/no_unisons_in_middle.rb +0 -2
  77. data/lib/head_music/style/guidelines/notes_same_length.rb +0 -2
  78. data/lib/head_music/style/guidelines/one_to_one.rb +0 -2
  79. data/lib/head_music/style/guidelines/prefer_contrary_motion.rb +0 -2
  80. data/lib/head_music/style/guidelines/prefer_imperfect.rb +0 -2
  81. data/lib/head_music/style/guidelines/prepare_octave_leaps.rb +0 -2
  82. data/lib/head_music/style/guidelines/recover_large_leaps.rb +0 -2
  83. data/lib/head_music/style/guidelines/singable_intervals.rb +0 -2
  84. data/lib/head_music/style/guidelines/singable_range.rb +0 -2
  85. data/lib/head_music/style/guidelines/single_large_leaps.rb +0 -2
  86. data/lib/head_music/style/guidelines/start_on_perfect_consonance.rb +0 -2
  87. data/lib/head_music/style/guidelines/start_on_tonic.rb +0 -2
  88. data/lib/head_music/style/guidelines/step_down_to_final_note.rb +0 -2
  89. data/lib/head_music/style/guidelines/step_out_of_unison.rb +0 -2
  90. data/lib/head_music/style/guidelines/step_to_final_note.rb +0 -2
  91. data/lib/head_music/style/guidelines/step_up_to_final_note.rb +0 -2
  92. data/lib/head_music/style/guidelines/up_to_fourteen_notes.rb +0 -2
  93. data/lib/head_music/style/guides/first_species_harmony.rb +0 -2
  94. data/lib/head_music/style/guides/first_species_melody.rb +0 -2
  95. data/lib/head_music/style/guides/fux_cantus_firmus.rb +0 -2
  96. data/lib/head_music/style/guides/modern_cantus_firmus.rb +0 -2
  97. data/lib/head_music/style/mark.rb +0 -2
  98. data/lib/head_music/tuning.rb +0 -2
  99. data/lib/head_music/utilities/hash_key.rb +0 -2
  100. data/lib/head_music/version.rb +1 -3
  101. data/lib/head_music.rb +4 -3
  102. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abe406f428c40b4ad6937006865ed6a6e8f70ee1fc682802406ef2bce97b27c0
4
- data.tar.gz: 1e0264aae4a9fa7d904549f5e6decee869de8cd42be7b97f3850f59f6e3ed8cb
3
+ metadata.gz: 4225259e4cfbb1eac6257f4840b10731b58d1a09b52b87677e00522fdb2a7351
4
+ data.tar.gz: 92e620b782cb6a7e424e97b98d7eeb50b130b11f11293b494274dc382a0ac62d
5
5
  SHA512:
6
- metadata.gz: 4ba99a2957586f795ff211b92573551bbd6fd3b1b1333f0d826d90ddf80f529680769359e5edbee8f90950c620240f8289efd8ce8e8be7cb465f6e948c44b254
7
- data.tar.gz: 0c1ab4d6ba42810f0b1f740a0dc44eb0674a2ce5bd82e211fd5403f040d288b07a017386f83a6dd2661d52ef8e5698fe82327604e373d709c4184b3af5679be2
6
+ metadata.gz: 7a41a9bf9e1e724990819ad1f9ed93889a5433f80407426250d7cef27248d69155f46db4838fd7cfd99b5bdeb680b40ce5a8c00acdcffd76a1260dbe7ce300c6
7
+ data.tar.gz: 1b6053743fb591e4cf8428faf09732ce2ab1c271cc37759b732cf36fb9b6021adc26ec4c444312beb98d01c3d68ecdb9db97b13efa8dc9c8040f5b31f35b9973
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  source "https://rubygems.org"
4
2
 
5
3
  ruby "3.2.2"
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "bundler/gem_tasks"
4
2
  require "rspec/core/rake_task"
5
3
  require "standard/rake"
data/bin/console CHANGED
@@ -1,6 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
2
  require "bundler/setup"
5
3
  require "head_music"
6
4
 
data/head_music.gemspec CHANGED
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  lib = File.expand_path("lib", __dir__)
4
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
3
  require "head_music/version"
@@ -1,17 +1,15 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "head_music/musical_symbol"
4
2
 
5
- # A Sign is a symbol that modifies pitch, such as a sharp, flat, or natural.
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::Sign
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
- SIGN_RECORDS = [
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
- SIGN_IDENTIFIERS = SIGN_RECORDS.map { |attributes| attributes[:identifier] }.freeze
35
+ ALTERATION_IDENTIFIERS = ALTERATION_RECORDS.map { |attributes| attributes[:identifier] }.freeze
38
36
 
39
37
  def self.all
40
- SIGN_RECORDS.map { |attributes| new(attributes) }
38
+ ALTERATION_RECORDS.map { |attributes| new(attributes) }
41
39
  end
42
40
 
43
41
  def self.symbols
44
- @symbols ||= all.map { |sign| [sign.ascii, sign.unicode] }.flatten.reject { |s| s.nil? || s.empty? }
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::Sign)
54
+ return identifier if identifier.is_a?(HeadMusic::Alteration)
57
55
 
58
- all.detect do |sign|
59
- sign.representions.include?(identifier)
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 |sign|
65
- sign.send(key) == value if %i[cents semitones].include?(key.to_sym)
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
- SIGN_IDENTIFIERS.each do |key|
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::Sign.get(other)
89
+ other = HeadMusic::Alteration.get(other)
92
90
  cents <=> other.cents
93
91
  end
94
92
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # A chromatic interval is the distance between two pitches measured in half-steps.
4
2
  class HeadMusic::ChromaticInterval
5
3
  include Comparable
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "head_music/interval_cycle"
4
2
 
5
3
  # A Circle of Fifths or Fourths shows relationships between pitch classes
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "yaml"
4
2
 
5
3
  # A clef assigns pitches to the lines and spaces of a staff.
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Consonance describes a category or degree of harmonic pleasantness: perfect, imperfect, or dissonant
4
2
  class HeadMusic::Consonance
5
3
  LEVELS = %w[perfect imperfect dissonant].freeze
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # A module for musical content
4
2
  module HeadMusic::Content; end
5
3
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # A module for musical content
4
2
  module HeadMusic::Content; end
5
3
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # A module for musical content
4
2
  module HeadMusic::Content; end
5
3
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # A module for musical content
4
2
  module HeadMusic::Content; end
5
3
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # A module for musical content
4
2
  module HeadMusic::Content; end
5
3
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # A module for musical content
4
2
  module HeadMusic::Content; end
5
3
 
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # A module for musical content
4
2
  module HeadMusic::Content; end
5
3
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- accordian:
2
+ accordion:
3
3
  classification_keys:
4
4
  - reed
5
5
  - free-reed
@@ -226,4 +226,4 @@ xylophone:
226
226
  - keyboard
227
227
  - mallet
228
228
  - wood
229
- orchestra_section_key: percussion
229
+ orchestra_section_key: percussion