head_music 4.0.1 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) 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 +1 -1
  19. data/lib/head_music/data/instruments.yml +570 -522
  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_variant.rb +35 -0
  23. data/lib/head_music/instrument/staff.rb +30 -0
  24. data/lib/head_music/instrument/staff_scheme.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/en.yml +2 -1
  30. data/lib/head_music/melodic_interval.rb +0 -2
  31. data/lib/head_music/meter.rb +0 -2
  32. data/lib/head_music/motion.rb +0 -2
  33. data/lib/head_music/musical_symbol.rb +0 -2
  34. data/lib/head_music/named.rb +0 -2
  35. data/lib/head_music/pitch/enharmonic_equivalence.rb +0 -2
  36. data/lib/head_music/pitch/octave_equivalence.rb +0 -2
  37. data/lib/head_music/pitch.rb +7 -9
  38. data/lib/head_music/pitch_class.rb +0 -2
  39. data/lib/head_music/pitch_class_set.rb +0 -2
  40. data/lib/head_music/pitch_set.rb +0 -2
  41. data/lib/head_music/quality.rb +0 -2
  42. data/lib/head_music/reference_pitch.rb +0 -2
  43. data/lib/head_music/register.rb +0 -2
  44. data/lib/head_music/rhythm.rb +0 -2
  45. data/lib/head_music/rhythmic_unit.rb +0 -2
  46. data/lib/head_music/scale.rb +0 -2
  47. data/lib/head_music/scale_degree.rb +8 -10
  48. data/lib/head_music/scale_type.rb +0 -2
  49. data/lib/head_music/solmization.rb +0 -2
  50. data/lib/head_music/sonority.rb +0 -2
  51. data/lib/head_music/spelling.rb +18 -20
  52. data/lib/head_music/staff.rb +0 -2
  53. data/lib/head_music/style/analysis.rb +0 -2
  54. data/lib/head_music/style/annotation.rb +0 -2
  55. data/lib/head_music/style/guidelines/always_move.rb +0 -2
  56. data/lib/head_music/style/guidelines/approach_perfection_contrarily.rb +0 -2
  57. data/lib/head_music/style/guidelines/at_least_eight_notes.rb +0 -2
  58. data/lib/head_music/style/guidelines/avoid_crossing_voices.rb +0 -2
  59. data/lib/head_music/style/guidelines/avoid_overlapping_voices.rb +0 -2
  60. data/lib/head_music/style/guidelines/consonant_climax.rb +0 -2
  61. data/lib/head_music/style/guidelines/consonant_downbeats.rb +0 -2
  62. data/lib/head_music/style/guidelines/diatonic.rb +1 -3
  63. data/lib/head_music/style/guidelines/direction_changes.rb +0 -2
  64. data/lib/head_music/style/guidelines/end_on_perfect_consonance.rb +0 -2
  65. data/lib/head_music/style/guidelines/end_on_tonic.rb +0 -2
  66. data/lib/head_music/style/guidelines/frequent_direction_changes.rb +0 -2
  67. data/lib/head_music/style/guidelines/limit_octave_leaps.rb +0 -2
  68. data/lib/head_music/style/guidelines/moderate_direction_changes.rb +0 -2
  69. data/lib/head_music/style/guidelines/mostly_conjunct.rb +0 -2
  70. data/lib/head_music/style/guidelines/no_rests.rb +0 -2
  71. data/lib/head_music/style/guidelines/no_unisons_in_middle.rb +0 -2
  72. data/lib/head_music/style/guidelines/notes_same_length.rb +0 -2
  73. data/lib/head_music/style/guidelines/one_to_one.rb +0 -2
  74. data/lib/head_music/style/guidelines/prefer_contrary_motion.rb +0 -2
  75. data/lib/head_music/style/guidelines/prefer_imperfect.rb +0 -2
  76. data/lib/head_music/style/guidelines/prepare_octave_leaps.rb +0 -2
  77. data/lib/head_music/style/guidelines/recover_large_leaps.rb +0 -2
  78. data/lib/head_music/style/guidelines/singable_intervals.rb +0 -2
  79. data/lib/head_music/style/guidelines/singable_range.rb +0 -2
  80. data/lib/head_music/style/guidelines/single_large_leaps.rb +0 -2
  81. data/lib/head_music/style/guidelines/start_on_perfect_consonance.rb +0 -2
  82. data/lib/head_music/style/guidelines/start_on_tonic.rb +0 -2
  83. data/lib/head_music/style/guidelines/step_down_to_final_note.rb +0 -2
  84. data/lib/head_music/style/guidelines/step_out_of_unison.rb +0 -2
  85. data/lib/head_music/style/guidelines/step_to_final_note.rb +0 -2
  86. data/lib/head_music/style/guidelines/step_up_to_final_note.rb +0 -2
  87. data/lib/head_music/style/guidelines/up_to_fourteen_notes.rb +0 -2
  88. data/lib/head_music/style/guides/first_species_harmony.rb +0 -2
  89. data/lib/head_music/style/guides/first_species_melody.rb +0 -2
  90. data/lib/head_music/style/guides/fux_cantus_firmus.rb +0 -2
  91. data/lib/head_music/style/guides/modern_cantus_firmus.rb +0 -2
  92. data/lib/head_music/style/mark.rb +0 -2
  93. data/lib/head_music/tuning.rb +0 -2
  94. data/lib/head_music/utilities/hash_key.rb +0 -2
  95. data/lib/head_music/version.rb +1 -3
  96. data/lib/head_music.rb +4 -3
  97. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf64a274a8669034f1e950e44d634207cac21129b88797441b848686fb7d6cfd
4
- data.tar.gz: 46c7c01be33463d5d2bd4cc9698dd9f9618ce18525b825f05f0d4b2a203a3f4f
3
+ metadata.gz: ee7c3b6377d30fa88d3f9e7f5b5450bf0664c65b4559ba6fccaf79d19ef3cfcf
4
+ data.tar.gz: 56ec218fb604b9c1c2fe3a6c2935a1157340afc0a23f3cb882ad9dd9980f1bcd
5
5
  SHA512:
6
- metadata.gz: 9c73a3dada33eac70781e8c6535d515e679ac6f640c90a60a019223da065f62a8ed58df1c21554d212f5b399df37909784046e0742e6ff9aab19d5a103647f00
7
- data.tar.gz: bd49d3440597c77f32b836833ba2c9485d11d3187ea91b85d47cfe6fab7a7d14d56579e2438720d1395f37efbbaa01ed0a9bc7f546580db6e82eca6f9960e254
6
+ metadata.gz: 6c8b2afd59aae59bcd88a8d67aa1662e79d6086166da1588bdf502a720fb471b2c55b3b6ada13eb7f09e998cd8b8c8408ec4888303d0edd9cdf09accc64c92ed
7
+ data.tar.gz: 4076e9b2b22c369f6f7e08bd202cf333d54c410df206bcc0d06417a68142be232ef58fe174aae627922e5a5ef993a9f247e706d23c17cce0f927b49198f3b987
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
 
@@ -226,4 +226,4 @@ xylophone:
226
226
  - keyboard
227
227
  - mallet
228
228
  - wood
229
- orchestra_section_key: percussion
229
+ orchestra_section_key: percussion