head_music 7.0.5 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile +1 -1
  4. data/lib/head_music/{circle.rb → analysis/circle.rb} +9 -6
  5. data/lib/head_music/{diatonic_interval → analysis/diatonic_interval}/category.rb +1 -1
  6. data/lib/head_music/{diatonic_interval → analysis/diatonic_interval}/naming.rb +6 -6
  7. data/lib/head_music/{diatonic_interval → analysis/diatonic_interval}/parser.rb +4 -4
  8. data/lib/head_music/{diatonic_interval → analysis/diatonic_interval}/semitones.rb +4 -4
  9. data/lib/head_music/{diatonic_interval → analysis/diatonic_interval}/size.rb +1 -1
  10. data/lib/head_music/{diatonic_interval.rb → analysis/diatonic_interval.rb} +19 -16
  11. data/lib/head_music/{harmonic_interval.rb → analysis/harmonic_interval.rb} +5 -2
  12. data/lib/head_music/{interval_cycle.rb → analysis/interval_cycle.rb} +12 -9
  13. data/lib/head_music/{melodic_interval.rb → analysis/melodic_interval.rb} +7 -4
  14. data/lib/head_music/{motion.rb → analysis/motion.rb} +6 -3
  15. data/lib/head_music/{pitch_class_set.rb → analysis/pitch_class_set.rb} +5 -2
  16. data/lib/head_music/{pitch_set.rb → analysis/pitch_set.rb} +14 -11
  17. data/lib/head_music/{sonority.rb → analysis/sonority.rb} +7 -4
  18. data/lib/head_music/content/bar.rb +2 -2
  19. data/lib/head_music/content/composition.rb +3 -3
  20. data/lib/head_music/content/note.rb +1 -1
  21. data/lib/head_music/content/placement.rb +1 -1
  22. data/lib/head_music/content/position.rb +1 -1
  23. data/lib/head_music/content/rhythmic_value.rb +3 -3
  24. data/lib/head_music/{staff.rb → content/staff.rb} +6 -3
  25. data/lib/head_music/content/voice.rb +2 -2
  26. data/lib/head_music/{instrument.rb → instruments/instrument.rb} +10 -7
  27. data/lib/head_music/{data → instruments}/instrument_families.yml +49 -0
  28. data/lib/head_music/{instrument_family.rb → instruments/instrument_family.rb} +5 -2
  29. data/lib/head_music/{data → instruments}/instruments.yml +116 -0
  30. data/lib/head_music/{instrument → instruments}/staff.rb +5 -2
  31. data/lib/head_music/{instrument → instruments}/staff_scheme.rb +7 -2
  32. data/lib/head_music/{instrument → instruments}/variant.rb +6 -3
  33. data/lib/head_music/locales/en.yml +22 -0
  34. data/lib/head_music/{alteration.rb → rudiment/alteration.rb} +9 -6
  35. data/lib/head_music/{chromatic_interval.rb → rudiment/chromatic_interval.rb} +7 -4
  36. data/lib/head_music/{clef.rb → rudiment/clef.rb} +7 -4
  37. data/lib/head_music/{consonance.rb → rudiment/consonance.rb} +4 -1
  38. data/lib/head_music/{key_signature → rudiment/key_signature}/enharmonic_equivalence.rb +4 -4
  39. data/lib/head_music/{key_signature.rb → rudiment/key_signature.rb} +10 -7
  40. data/lib/head_music/{letter_name.rb → rudiment/letter_name.rb} +9 -6
  41. data/lib/head_music/{meter.rb → rudiment/meter.rb} +6 -3
  42. data/lib/head_music/{musical_symbol.rb → rudiment/musical_symbol.rb} +4 -1
  43. data/lib/head_music/{pitch → rudiment/pitch}/enharmonic_equivalence.rb +4 -4
  44. data/lib/head_music/{pitch → rudiment/pitch}/octave_equivalence.rb +2 -2
  45. data/lib/head_music/{pitch.rb → rudiment/pitch.rb} +30 -27
  46. data/lib/head_music/{pitch_class.rb → rudiment/pitch_class.rb} +14 -11
  47. data/lib/head_music/{quality.rb → rudiment/quality.rb} +4 -1
  48. data/lib/head_music/{reference_pitch.rb → rudiment/reference_pitch.rb} +5 -2
  49. data/lib/head_music/{register.rb → rudiment/register.rb} +6 -3
  50. data/lib/head_music/rudiment/rhythm.rb +6 -0
  51. data/lib/head_music/{rhythmic_unit.rb → rudiment/rhythmic_unit.rb} +5 -2
  52. data/lib/head_music/{scale.rb → rudiment/scale.rb} +12 -9
  53. data/lib/head_music/{scale_degree.rb → rudiment/scale_degree.rb} +8 -5
  54. data/lib/head_music/{scale_type.rb → rudiment/scale_type.rb} +4 -1
  55. data/lib/head_music/{solmization.rb → rudiment/solmization.rb} +4 -1
  56. data/lib/head_music/{spelling.rb → rudiment/spelling.rb} +20 -17
  57. data/lib/head_music/{tuning.rb → rudiment/tuning.rb} +6 -3
  58. data/lib/head_music/style/annotation.rb +6 -6
  59. data/lib/head_music/style/guidelines/consonant_climax.rb +4 -4
  60. data/lib/head_music/style/guidelines/diatonic.rb +1 -1
  61. data/lib/head_music/style/guidelines/step_out_of_unison.rb +1 -1
  62. data/lib/head_music/version.rb +1 -1
  63. data/lib/head_music.rb +50 -46
  64. metadata +51 -51
  65. data/lib/head_music/rhythm.rb +0 -3
  66. /data/lib/head_music/{data → rudiment}/clefs.yml +0 -0
  67. /data/lib/head_music/{solmizations.yml → rudiment/solmizations.yml} +0 -0
@@ -1,3 +1,6 @@
1
+ # Namespace for instrument definitions, categorization, and configuration
2
+ module HeadMusic::Instruments; end
3
+
1
4
  # A musical instrument.
2
5
  # An instrument object can be assigned to a staff object.
3
6
  # Attributes:
@@ -14,17 +17,17 @@
14
17
  # Associations:
15
18
  # family: the family of the instrument (e.g. "saxophone")
16
19
  # orchestra_section: the section of the orchestra (e.g. "strings")
17
- class HeadMusic::Instrument
20
+ class HeadMusic::Instruments::Instrument
18
21
  include HeadMusic::Named
19
22
 
20
- INSTRUMENTS = YAML.load_file(File.expand_path("data/instruments.yml", __dir__)).freeze
23
+ INSTRUMENTS = YAML.load_file(File.expand_path("instruments.yml", __dir__)).freeze
21
24
 
22
25
  def self.get(name)
23
26
  get_by_name(name)
24
27
  end
25
28
 
26
29
  def self.all
27
- HeadMusic::InstrumentFamily.all
30
+ HeadMusic::Instruments::InstrumentFamily.all
28
31
  @all ||=
29
32
  INSTRUMENTS.map { |key, _data| get(key) }.sort_by { |instrument| instrument.name.downcase }
30
33
  end
@@ -48,7 +51,7 @@ class HeadMusic::Instrument
48
51
  def family
49
52
  return unless family_key
50
53
 
51
- HeadMusic::InstrumentFamily.get(family_key)
54
+ HeadMusic::Instruments::InstrumentFamily.get(family_key)
52
55
  end
53
56
 
54
57
  # Returns true if the instrument sounds at a different pitch than written.
@@ -70,7 +73,7 @@ class HeadMusic::Instrument
70
73
  end
71
74
 
72
75
  def pitched?
73
- return false if default_clefs.compact.uniq == [HeadMusic::Clef.get("neutral_clef")]
76
+ return false if default_clefs.compact.uniq == [HeadMusic::Rudiment::Clef.get("neutral_clef")]
74
77
 
75
78
  default_clefs.any?
76
79
  end
@@ -139,7 +142,7 @@ class HeadMusic::Instrument
139
142
 
140
143
  def initialize_family(record)
141
144
  @family_key = record["family_key"]
142
- @family = HeadMusic::InstrumentFamily.get(family_key)
145
+ @family = HeadMusic::Instruments::InstrumentFamily.get(family_key)
143
146
  end
144
147
 
145
148
  def inherit_family_attributes(record)
@@ -160,7 +163,7 @@ class HeadMusic::Instrument
160
163
  @classification_keys = [@classification_keys, record["classification_keys"]].flatten.compact.uniq
161
164
  @variants =
162
165
  (record["variants"] || {}).map do |key, attributes|
163
- HeadMusic::Instrument::Variant.new(key, attributes)
166
+ HeadMusic::Instruments::Variant.new(key, attributes)
164
167
  end
165
168
  end
166
169
 
@@ -47,7 +47,12 @@ cymbal:
47
47
  classification_keys:
48
48
  - percussion
49
49
  - idiophone
50
+ - unpitched
50
51
  orchestra_section_key: percussion
52
+ didgeridoo:
53
+ classification_keys:
54
+ - aerophone
55
+ - wind
51
56
  double_bass:
52
57
  classification_keys:
53
58
  - bowed
@@ -69,11 +74,13 @@ glockenspiel:
69
74
  - struck
70
75
  - metal
71
76
  - mallet
77
+ - pitched
72
78
  orchestra_section_key: percussion
73
79
  gong:
74
80
  classification_keys:
75
81
  - percussion
76
82
  - idiophone
83
+ - unpitched
77
84
  orchestra_section_key: percussion
78
85
  guitar:
79
86
  classification_keys:
@@ -81,6 +88,13 @@ guitar:
81
88
  - plucked
82
89
  - string
83
90
  orchestra_section_key: string
91
+ harmonica:
92
+ classification_keys:
93
+ - reed
94
+ - free-reed
95
+ - aerophone
96
+ - wind
97
+ orchestra_section_key: woodwind
84
98
  harp:
85
99
  classification_keys:
86
100
  - chordophone
@@ -104,6 +118,7 @@ kettledrum:
104
118
  classification_keys:
105
119
  - percussion
106
120
  - membranophone
121
+ - pitched
107
122
  orchestra_section_key: percussion
108
123
  lute:
109
124
  classification_keys:
@@ -125,6 +140,7 @@ marimba:
125
140
  - struck
126
141
  - wood
127
142
  - mallet
143
+ - pitched
128
144
  orchestra_section_key: percussion
129
145
  oboe:
130
146
  classification_keys:
@@ -166,16 +182,40 @@ saxophone:
166
182
  - wind
167
183
  - woodwind
168
184
  orchestra_section_key: woodwind
185
+ sitar:
186
+ classification_keys:
187
+ - chordophone
188
+ - plucked
189
+ - string
190
+ orchestra_section_key: string
169
191
  snare_drum:
170
192
  classification_keys:
171
193
  - percussion
172
194
  - membranophone
195
+ - unpitched
196
+ orchestra_section_key: percussion
197
+ steelpan:
198
+ classification_keys:
199
+ - percussion
200
+ - idiophone
201
+ - struck
202
+ - metal
203
+ - pitched
173
204
  orchestra_section_key: percussion
174
205
  synthesizer:
175
206
  classification_keys:
176
207
  - electronic
177
208
  - keyboard
178
209
  orchestra_section_key: keyboard
210
+ tabla:
211
+ classification_keys:
212
+ - percussion
213
+ - membranophone
214
+ - pitched
215
+ orchestra_section_key: percussion
216
+ theremin:
217
+ classification_keys:
218
+ - electronic
179
219
  trombone:
180
220
  classification_keys:
181
221
  - aerophone
@@ -194,6 +234,12 @@ tuba:
194
234
  - brass
195
235
  - wind
196
236
  orchestra_section_key: brass
237
+ ukulele:
238
+ classification_keys:
239
+ - chordophone
240
+ - plucked
241
+ - string
242
+ orchestra_section_key: string
197
243
  vibraphone:
198
244
  classification_keys:
199
245
  - percussion
@@ -202,6 +248,7 @@ vibraphone:
202
248
  - keyboard
203
249
  - mallet
204
250
  - metal
251
+ - pitched
205
252
  orchestra_section_key: percussion
206
253
  violin:
207
254
  classification_keys:
@@ -218,6 +265,7 @@ woodblock:
218
265
  - percussion
219
266
  - struck
220
267
  - idiophone
268
+ - unpitched
221
269
  orchestra_section_key: percussion
222
270
  xylophone:
223
271
  classification_keys:
@@ -227,4 +275,5 @@ xylophone:
227
275
  - keyboard
228
276
  - mallet
229
277
  - wood
278
+ - pitched
230
279
  orchestra_section_key: percussion
@@ -1,12 +1,15 @@
1
+ # Namespace for instrument definitions, categorization, and configuration
2
+ module HeadMusic::Instruments; end
3
+
1
4
  # An *InstrumentFamily* is a species of instrument
2
5
  # that may exist in a variety of keys or other variations.
3
6
  # For example, _saxophone_ is an instrument family, while
4
7
  # _alto saxophone_ and _baritone saxophone_ are specific instruments.
5
- class HeadMusic::InstrumentFamily
8
+ class HeadMusic::Instruments::InstrumentFamily
6
9
  include HeadMusic::Named
7
10
 
8
11
  INSTRUMENT_FAMILIES =
9
- YAML.load_file(File.expand_path("data/instrument_families.yml", __dir__)).freeze
12
+ YAML.load_file(File.expand_path("instrument_families.yml", __dir__)).freeze
10
13
 
11
14
  attr_reader :name_key, :classification_keys, :orchestra_section_key
12
15
  attr_accessor :name
@@ -458,6 +458,13 @@ cymbal:
458
458
  staff_schemes:
459
459
  default:
460
460
  - clef: neutral_clef
461
+ didgeridoo:
462
+ family_key: didgeridoo
463
+ variants:
464
+ default:
465
+ staff_schemes:
466
+ default:
467
+ - clef: neutral_clef
461
468
  double_bass:
462
469
  alias_name_keys:
463
470
  - contrabass
@@ -561,6 +568,15 @@ hammered_dulcimer:
561
568
  default:
562
569
  - clef: treble_clef
563
570
  orchestra_section_key: percussion
571
+ harmonica:
572
+ alias_name_keys:
573
+ - mouth_organ
574
+ family_key: harmonica
575
+ variants:
576
+ default:
577
+ staff_schemes:
578
+ default:
579
+ - clef: treble_clef
564
580
  harp:
565
581
  family_key: harp
566
582
  variants:
@@ -963,6 +979,13 @@ subcontrabass_saxophone:
963
979
  sounding_transposition: -38
964
980
  range_categories:
965
981
  - subcontrabass
982
+ sitar:
983
+ family_key: sitar
984
+ variants:
985
+ default:
986
+ staff_schemes:
987
+ default:
988
+ - clef: treble_clef
966
989
  snare_drum:
967
990
  alias_name_keys:
968
991
  - side_drum
@@ -997,6 +1020,15 @@ sousaphone:
997
1020
  sounding_transposition: 0
998
1021
  range_categories:
999
1022
  - bass
1023
+ steelpan:
1024
+ alias_name_keys:
1025
+ - steel_drum
1026
+ family_key: steelpan
1027
+ variants:
1028
+ default:
1029
+ staff_schemes:
1030
+ default:
1031
+ - clef: treble_clef
1000
1032
  suspended_cymbal:
1001
1033
  family_key: cymbal
1002
1034
  variants:
@@ -1005,6 +1037,8 @@ suspended_cymbal:
1005
1037
  default:
1006
1038
  - clef: neutral_clef
1007
1039
  synthesizer:
1040
+ alias_name_keys:
1041
+ - electronic_keyboard
1008
1042
  family_key: synthesizer
1009
1043
  variants:
1010
1044
  default:
@@ -1014,6 +1048,13 @@ synthesizer:
1014
1048
  name_key: right_hand
1015
1049
  - clef: bass_clef
1016
1050
  name_key: left_hand
1051
+ tabla:
1052
+ family_key: tabla
1053
+ variants:
1054
+ default:
1055
+ staff_schemes:
1056
+ default:
1057
+ - clef: neutral_clef
1017
1058
  tam_tam:
1018
1059
  alias_name_keys:
1019
1060
  - gong
@@ -1069,6 +1110,13 @@ tenor_voice:
1069
1110
  sounding_transposition: -12
1070
1111
  range_categories:
1071
1112
  - tenor
1113
+ theremin:
1114
+ family_key: theremin
1115
+ variants:
1116
+ default:
1117
+ staff_schemes:
1118
+ default:
1119
+ - clef: treble_clef
1072
1120
  timpani:
1073
1121
  alias_name_keys:
1074
1122
  - kettledrum
@@ -1148,6 +1196,74 @@ tuba:
1148
1196
  staff_schemes:
1149
1197
  default:
1150
1198
  - clef: bass_clef
1199
+ ukulele:
1200
+ alias_name_keys:
1201
+ - soprano_ukulele
1202
+ family_key: ukulele
1203
+ variants:
1204
+ default:
1205
+ staff_schemes:
1206
+ default:
1207
+ - clef: treble_clef
1208
+ range_categories:
1209
+ - soprano
1210
+ - alto
1211
+ pocket_ukulele:
1212
+ alias_name_keys:
1213
+ - sopranino_ukulele
1214
+ - piccolo_ukulele
1215
+ family_key: ukulele
1216
+ variants:
1217
+ default:
1218
+ staff_schemes:
1219
+ default:
1220
+ - clef: treble_clef
1221
+ range_categories:
1222
+ - sopranino
1223
+ - soprano
1224
+ concert_ukulele:
1225
+ alias_name_keys:
1226
+ - alto_ukulele
1227
+ family_key: ukulele
1228
+ variants:
1229
+ default:
1230
+ staff_schemes:
1231
+ default:
1232
+ - clef: treble_clef
1233
+ range_categories:
1234
+ - soprano
1235
+ - alto
1236
+ tenor_ukulele:
1237
+ family_key: ukulele
1238
+ variants:
1239
+ default:
1240
+ staff_schemes:
1241
+ default:
1242
+ - clef: treble_clef
1243
+ range_categories:
1244
+ - tenor
1245
+ baritone_ukulele:
1246
+ family_key: ukulele
1247
+ variants:
1248
+ default:
1249
+ staff_schemes:
1250
+ default:
1251
+ - clef: treble_clef
1252
+ range_categories:
1253
+ - alto
1254
+ - tenor
1255
+ - baritone
1256
+ bass_ukulele:
1257
+ family_key: ukulele
1258
+ variants:
1259
+ default:
1260
+ staff_schemes:
1261
+ default:
1262
+ - clef: bass_clef
1263
+ range_categories:
1264
+ - bass
1265
+ - baritone
1266
+ - tenor
1151
1267
  vibraphone:
1152
1268
  alias_name_keys:
1153
1269
  - vibes
@@ -1,4 +1,7 @@
1
- class HeadMusic::Instrument::Staff
1
+ # Namespace for instrument definitions, categorization, and configuration
2
+ module HeadMusic::Instruments; end
3
+
4
+ class HeadMusic::Instruments::Staff
2
5
  DEFAULT_CLEF = "treble_clef"
3
6
 
4
7
  attr_reader :staff_scheme, :attributes
@@ -9,7 +12,7 @@ class HeadMusic::Instrument::Staff
9
12
  end
10
13
 
11
14
  def clef
12
- HeadMusic::Clef.get(smart_clef_key)
15
+ HeadMusic::Rudiment::Clef.get(smart_clef_key)
13
16
  end
14
17
 
15
18
  def smart_clef_key
@@ -1,4 +1,9 @@
1
- class HeadMusic::Instrument::StaffScheme
1
+ require_relative "staff"
2
+
3
+ # Namespace for instrument definitions, categorization, and configuration
4
+ module HeadMusic::Instruments; end
5
+
6
+ class HeadMusic::Instruments::StaffScheme
2
7
  attr_reader :variant, :key, :list
3
8
 
4
9
  def initialize(variant:, key:, list:)
@@ -13,7 +18,7 @@ class HeadMusic::Instrument::StaffScheme
13
18
 
14
19
  def staves
15
20
  @staves ||= list.map do |attributes|
16
- HeadMusic::Instrument::Staff.new(self, attributes)
21
+ HeadMusic::Instruments::Staff.new(self, attributes)
17
22
  end
18
23
  end
19
24
  end
@@ -1,4 +1,7 @@
1
- class HeadMusic::Instrument::Variant
1
+ # Namespace for instrument definitions, categorization, and configuration
2
+ module HeadMusic::Instruments; end
3
+
4
+ class HeadMusic::Instruments::Variant
2
5
  attr_reader :key, :attributes
3
6
 
4
7
  def initialize(key, attributes = {})
@@ -10,13 +13,13 @@ class HeadMusic::Instrument::Variant
10
13
  return unless attributes["pitch_designation"].to_s != ""
11
14
 
12
15
  @pitch_designation ||=
13
- HeadMusic::Spelling.get(attributes["pitch_designation"])
16
+ HeadMusic::Rudiment::Spelling.get(attributes["pitch_designation"])
14
17
  end
15
18
 
16
19
  def staff_schemes
17
20
  @staff_schemes ||=
18
21
  (attributes["staff_schemes"] || {}).map do |key, list|
19
- HeadMusic::Instrument::StaffScheme.new(
22
+ HeadMusic::Instruments::StaffScheme.new(
20
23
  key: key,
21
24
  variant: self,
22
25
  list: list
@@ -86,6 +86,7 @@ en:
86
86
  mezzo_soprano_voice: mezzo-soprano
87
87
  percussion: percussion
88
88
  percussion_instrument: percussion instrument
89
+ pitched: pitched
89
90
  plucked: plucked
90
91
  plucked_instrument: plucked instrument
91
92
  reed: reed
@@ -95,6 +96,7 @@ en:
95
96
  stringed_instrument: stringed instrument
96
97
  strings: strings
97
98
  struck: struck
99
+ unpitched: unpitched
98
100
  voice: voice
99
101
  wind: wind
100
102
  wind_instrument: wind instrument
@@ -119,6 +121,7 @@ en:
119
121
  alto_flute: alto flute
120
122
  alto_recorder: alto recorder
121
123
  alto_saxophone: alto saxophone
124
+ alto_ukulele: alto ukulele
122
125
  alto_voice: alto
123
126
  arpeggione: arpeggione
124
127
  bagpipe: bagpipe
@@ -126,6 +129,7 @@ en:
126
129
  baritone_horn: baritone horn
127
130
  baritone_oboe: baritone oboe
128
131
  baritone_saxophone: baritone saxophone
132
+ baritone_ukulele: baritone ukulele
129
133
  baritone_voice: baritone
130
134
  bass: bass
131
135
  bass_clarinet: bass clarinet
@@ -137,6 +141,7 @@ en:
137
141
  bass_trombone: bass trombone
138
142
  bass_trumpet: bass trumpet
139
143
  bass_tuba: bass tuba
144
+ bass_ukulele: bass ukulele
140
145
  bass_voice: bass
141
146
  basset_horn: basset horn
142
147
  basset_recorder: basset recorder
@@ -154,6 +159,7 @@ en:
154
159
  clavichord: clavichord
155
160
  concert_bells: concert bells
156
161
  concert_cymbals: concert cymbals
162
+ concert_ukulele: concert ukulele
157
163
  contra_great_bass_recorder: contra-great bass recorder
158
164
  contrabass: contrabass
159
165
  contrabass_clarinet: contrabass clarinet
@@ -171,8 +177,10 @@ en:
171
177
  crotales: crotales
172
178
  cymbal: cymbal
173
179
  descant: descant
180
+ didgeridoo: didgeridoo
174
181
  double_bass: double bass
175
182
  double_contrabass_recorder: double-contrabass recorder
183
+ electronic_keyboard: electronic keyboard
176
184
  english_horn: English horn
177
185
  euphonium: euphonium
178
186
  fiddle: fiddle
@@ -188,6 +196,7 @@ en:
188
196
  great_highland_bagpipe: great highland bagpipe
189
197
  guitar: guitar
190
198
  hammered_dulcimer: hammered dulcimer
199
+ harmonica: harmonica
191
200
  harp: harp
192
201
  harpsichord: harpsichord
193
202
  hautbois_d_amour: hautbois d'amour
@@ -204,6 +213,7 @@ en:
204
213
  mezzo_soprano: mezzo-soprano
205
214
  mezzo_soprano_voice: mezzo-soprano
206
215
  military_drum: military drum
216
+ mouth_organ: mouth_organ
207
217
  natural_horn: natural horn
208
218
  oboe: oboe
209
219
  oboe_d_amore: oboe d'amore
@@ -219,25 +229,33 @@ en:
219
229
  piccolo_recorder: piccolo recorder
220
230
  piccolo_saxophone: piccolo saxophone
221
231
  piccolo_trumpet: piccolo trumpet
232
+ piccolo_ukulele: piccolo ukulele
222
233
  pipe_organ: pipe organ
234
+ pocket_trumpet: pocket trumpet
235
+ pocket_ukulele: pocket ukulele
223
236
  quart_bass_recorder: quart bass recorder
224
237
  recorder: recorder
225
238
  ride_cymbal: ride cymbal
226
239
  saxophone: saxophone
227
240
  side_drum: side drum
241
+ sitar: sitar
228
242
  snare_drum: snare drum
229
243
  sopranino_clarinet: sopranino clarinet
230
244
  sopranino_recorder: sopranino recorder
231
245
  sopranino_saxophone: sopranino saxophone
246
+ sopranino_ukulele: sopranino ukulele
232
247
  sopranissimo_recorder: sopranissimo recorder
233
248
  sopranissimo_saxophone: sopranissimo saxophone
234
249
  soprano: soprano
235
250
  soprano_clarinet: soprano clarinet
236
251
  soprano_recorder: soprano recorder
237
252
  soprano_saxophone: soprano saxophone
253
+ soprano_ukulele: soprano ukulele
238
254
  soprano_voice: soprano
239
255
  soprillo: soprillo
240
256
  sousaphone: sousaphone
257
+ steelpan: steelpan
258
+ steel_drum: steel drum
241
259
  string_bass: string bass
242
260
  sub_bass_recorder: sub-bass recorder
243
261
  sub_contrabass_recorder: sub-contrabass recorder
@@ -245,6 +263,7 @@ en:
245
263
  subcontrabass_saxophone: subcontrabass saxophone
246
264
  suspended_cymbal: suspended cymbal
247
265
  synthesizer: synthesizer
266
+ tabla: tabla
248
267
  tabor: tabor
249
268
  tam_tam: tam-tam
250
269
  tambourine: tambourine
@@ -255,7 +274,9 @@ en:
255
274
  tenor_saxophone: tenor saxophone
256
275
  tenor_trombone: tenor trombone
257
276
  tenor_tuba: tenor tuba
277
+ tenor_ukulele: tenor ukulele
258
278
  tenor_voice: tenor
279
+ theremin: theremin
259
280
  timpani: timpani
260
281
  timpanum: timpanum
261
282
  tom_drum: tom drum
@@ -266,6 +287,7 @@ en:
266
287
  trumpet: trumpet
267
288
  tuba: tuba
268
289
  tubular_bells: tubular bells
290
+ ukulele: ukulele
269
291
  vibes: vibes
270
292
  vibraphone: vibraphone
271
293
  viola: viola
@@ -1,8 +1,11 @@
1
- require "head_music/musical_symbol"
1
+ require "head_music/rudiment/musical_symbol"
2
2
 
3
- # A Alteration is a symbol that modifies pitch, such as a sharp, flat, or natural.
3
+ # A module for music rudiments
4
+ module HeadMusic::Rudiment; end
5
+
6
+ # An Alteration is a symbol that modifies pitch, such as a sharp, flat, or natural.
4
7
  # In French, sharps and flats in the key signature are called "altérations".
5
- class HeadMusic::Alteration
8
+ class HeadMusic::Rudiment::Alteration
6
9
  include Comparable
7
10
 
8
11
  attr_reader :identifier, :cents, :musical_symbols
@@ -51,7 +54,7 @@ class HeadMusic::Alteration
51
54
  end
52
55
 
53
56
  def self.get(identifier)
54
- return identifier if identifier.is_a?(HeadMusic::Alteration)
57
+ return identifier if identifier.is_a?(HeadMusic::Rudiment::Alteration)
55
58
 
56
59
  all.detect do |alteration|
57
60
  alteration.representions.include?(identifier)
@@ -86,7 +89,7 @@ class HeadMusic::Alteration
86
89
  end
87
90
 
88
91
  def <=>(other)
89
- other = HeadMusic::Alteration.get(other)
92
+ other = HeadMusic::Rudiment::Alteration.get(other)
90
93
  cents <=> other.cents
91
94
  end
92
95
 
@@ -104,7 +107,7 @@ class HeadMusic::Alteration
104
107
 
105
108
  def initialize_musical_symbols(list)
106
109
  @musical_symbols = (list || []).map do |record|
107
- HeadMusic::MusicalSymbol.new(
110
+ HeadMusic::Rudiment::MusicalSymbol.new(
108
111
  unicode: record[:unicode],
109
112
  ascii: record[:ascii],
110
113
  html_entity: record[:html_entity]
@@ -1,5 +1,8 @@
1
+ # A module for music rudiments
2
+ module HeadMusic::Rudiment; end
3
+
1
4
  # A chromatic interval is the distance between two pitches measured in half-steps.
2
- class HeadMusic::ChromaticInterval
5
+ class HeadMusic::Rudiment::ChromaticInterval
3
6
  include Comparable
4
7
  include HeadMusic::Named
5
8
 
@@ -37,7 +40,7 @@ class HeadMusic::ChromaticInterval
37
40
  end
38
41
 
39
42
  def simple
40
- HeadMusic::ChromaticInterval.get(semitones % 12)
43
+ HeadMusic::Rudiment::ChromaticInterval.get(semitones % 12)
41
44
  end
42
45
 
43
46
  def simple?
@@ -60,11 +63,11 @@ class HeadMusic::ChromaticInterval
60
63
  alias_method :specific_interval, :semitones
61
64
 
62
65
  def +(other)
63
- HeadMusic::ChromaticInterval.get(to_i + other.to_i)
66
+ HeadMusic::Rudiment::ChromaticInterval.get(to_i + other.to_i)
64
67
  end
65
68
 
66
69
  def -(other)
67
- HeadMusic::ChromaticInterval.get((to_i - other.to_i).abs)
70
+ HeadMusic::Rudiment::ChromaticInterval.get((to_i - other.to_i).abs)
68
71
  end
69
72
 
70
73
  def <=>(other)
@@ -1,10 +1,13 @@
1
1
  require "yaml"
2
2
 
3
+ # A module for music rudiments
4
+ module HeadMusic::Rudiment; end
5
+
3
6
  # A clef assigns pitches to the lines and spaces of a staff.
4
- class HeadMusic::Clef
7
+ class HeadMusic::Rudiment::Clef
5
8
  include HeadMusic::Named
6
9
 
7
- RECORDS = YAML.load_file(File.expand_path("data/clefs.yml", __dir__)).freeze
10
+ RECORDS = YAML.load_file(File.expand_path("clefs.yml", __dir__)).freeze
8
11
 
9
12
  def self.get(name)
10
13
  get_by_name(name)
@@ -82,7 +85,7 @@ class HeadMusic::Clef
82
85
 
83
86
  def initialize_data_from_record(record)
84
87
  initialize_keys_from_record(record)
85
- @pitch = HeadMusic::Pitch.get(record[:pitch])
88
+ @pitch = HeadMusic::Rudiment::Pitch.get(record[:pitch])
86
89
  @line = record[:line]
87
90
  @modern = record[:modern]
88
91
  initialize_musical_symbols(record[:symbols])
@@ -95,7 +98,7 @@ class HeadMusic::Clef
95
98
 
96
99
  def initialize_musical_symbols(list)
97
100
  @musical_symbols = (list || []).map do |symbol_data|
98
- HeadMusic::MusicalSymbol.new(**symbol_data.slice(:ascii, :html_entity, :unicode))
101
+ HeadMusic::Rudiment::MusicalSymbol.new(**symbol_data.slice(:ascii, :html_entity, :unicode))
99
102
  end
100
103
  end
101
104
  end
@@ -1,5 +1,8 @@
1
+ # A module for music rudiments
2
+ module HeadMusic::Rudiment; end
3
+
1
4
  # Consonance describes a category or degree of harmonic pleasantness: perfect, imperfect, or dissonant
2
- class HeadMusic::Consonance
5
+ class HeadMusic::Rudiment::Consonance
3
6
  LEVELS = %w[perfect imperfect dissonant].freeze
4
7
 
5
8
  def self.get(name)