head_music 8.3.0 → 11.0.0

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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +9 -3
  3. data/CHANGELOG.md +71 -0
  4. data/CLAUDE.md +62 -25
  5. data/Gemfile +7 -1
  6. data/Gemfile.lock +91 -3
  7. data/MUSIC_THEORY.md +120 -0
  8. data/README.md +18 -0
  9. data/Rakefile +7 -2
  10. data/head_music.gemspec +1 -1
  11. data/lib/head_music/analysis/diatonic_interval.rb +29 -27
  12. data/lib/head_music/analysis/dyad.rb +229 -0
  13. data/lib/head_music/analysis/interval_consonance.rb +51 -0
  14. data/lib/head_music/analysis/melodic_interval.rb +1 -1
  15. data/lib/head_music/analysis/pitch_class_set.rb +111 -14
  16. data/lib/head_music/analysis/{pitch_set.rb → pitch_collection.rb} +11 -5
  17. data/lib/head_music/analysis/sonority.rb +50 -12
  18. data/lib/head_music/content/note.rb +1 -1
  19. data/lib/head_music/content/placement.rb +1 -1
  20. data/lib/head_music/content/position.rb +1 -1
  21. data/lib/head_music/content/voice.rb +1 -1
  22. data/lib/head_music/instruments/alternate_tuning.rb +102 -0
  23. data/lib/head_music/instruments/alternate_tunings.yml +78 -0
  24. data/lib/head_music/instruments/instrument.rb +231 -72
  25. data/lib/head_music/instruments/instrument_configuration.rb +66 -0
  26. data/lib/head_music/instruments/instrument_configuration_option.rb +38 -0
  27. data/lib/head_music/instruments/instrument_configurations.yml +288 -0
  28. data/lib/head_music/instruments/instrument_families.yml +77 -0
  29. data/lib/head_music/instruments/instrument_family.rb +15 -5
  30. data/lib/head_music/instruments/instruments.yml +795 -965
  31. data/lib/head_music/instruments/playing_technique.rb +75 -0
  32. data/lib/head_music/instruments/playing_techniques.yml +826 -0
  33. data/lib/head_music/instruments/score_order.rb +136 -0
  34. data/lib/head_music/instruments/score_orders.yml +130 -0
  35. data/lib/head_music/instruments/staff.rb +61 -1
  36. data/lib/head_music/instruments/staff_scheme.rb +6 -4
  37. data/lib/head_music/instruments/stringing.rb +115 -0
  38. data/lib/head_music/instruments/stringing_course.rb +58 -0
  39. data/lib/head_music/instruments/stringings.yml +168 -0
  40. data/lib/head_music/instruments/variant.rb +6 -1
  41. data/lib/head_music/locales/de.yml +29 -0
  42. data/lib/head_music/locales/en.yml +106 -0
  43. data/lib/head_music/locales/es.yml +29 -0
  44. data/lib/head_music/locales/fr.yml +29 -0
  45. data/lib/head_music/locales/it.yml +29 -0
  46. data/lib/head_music/locales/ru.yml +29 -0
  47. data/lib/head_music/{rudiment → notation}/musical_symbol.rb +3 -3
  48. data/lib/head_music/notation/staff_mapping.rb +70 -0
  49. data/lib/head_music/notation/staff_position.rb +62 -0
  50. data/lib/head_music/notation.rb +7 -0
  51. data/lib/head_music/rudiment/alteration.rb +34 -49
  52. data/lib/head_music/rudiment/alterations.yml +32 -0
  53. data/lib/head_music/rudiment/base.rb +9 -0
  54. data/lib/head_music/rudiment/chromatic_interval.rb +4 -7
  55. data/lib/head_music/rudiment/clef.rb +2 -2
  56. data/lib/head_music/rudiment/consonance.rb +39 -5
  57. data/lib/head_music/rudiment/diatonic_context.rb +25 -0
  58. data/lib/head_music/rudiment/key.rb +77 -0
  59. data/lib/head_music/rudiment/key_signature/enharmonic_equivalence.rb +1 -1
  60. data/lib/head_music/rudiment/key_signature.rb +21 -8
  61. data/lib/head_music/rudiment/letter_name.rb +3 -3
  62. data/lib/head_music/rudiment/meter.rb +19 -9
  63. data/lib/head_music/rudiment/mode.rb +92 -0
  64. data/lib/head_music/rudiment/note.rb +112 -0
  65. data/lib/head_music/rudiment/pitch/parser.rb +52 -0
  66. data/lib/head_music/rudiment/pitch.rb +5 -6
  67. data/lib/head_music/rudiment/pitch_class.rb +1 -1
  68. data/lib/head_music/rudiment/quality.rb +1 -1
  69. data/lib/head_music/rudiment/reference_pitch.rb +1 -1
  70. data/lib/head_music/rudiment/register.rb +4 -1
  71. data/lib/head_music/rudiment/rest.rb +36 -0
  72. data/lib/head_music/rudiment/rhythmic_element.rb +53 -0
  73. data/lib/head_music/rudiment/rhythmic_unit/parser.rb +86 -0
  74. data/lib/head_music/rudiment/rhythmic_unit.rb +13 -5
  75. data/lib/head_music/rudiment/rhythmic_units.yml +80 -0
  76. data/lib/head_music/rudiment/rhythmic_value/parser.rb +77 -0
  77. data/lib/head_music/{content → rudiment}/rhythmic_value.rb +23 -5
  78. data/lib/head_music/rudiment/scale.rb +4 -5
  79. data/lib/head_music/rudiment/scale_degree.rb +1 -1
  80. data/lib/head_music/rudiment/scale_type.rb +9 -3
  81. data/lib/head_music/rudiment/solmization.rb +1 -1
  82. data/lib/head_music/rudiment/spelling.rb +8 -4
  83. data/lib/head_music/rudiment/tempo.rb +85 -0
  84. data/lib/head_music/rudiment/tonal_context.rb +35 -0
  85. data/lib/head_music/rudiment/tuning/just_intonation.rb +0 -39
  86. data/lib/head_music/rudiment/tuning/meantone.rb +0 -39
  87. data/lib/head_music/rudiment/tuning/pythagorean.rb +0 -39
  88. data/lib/head_music/rudiment/tuning.rb +21 -1
  89. data/lib/head_music/rudiment/unpitched_note.rb +62 -0
  90. data/lib/head_music/style/guidelines/consonant_climax.rb +2 -2
  91. data/lib/head_music/style/medieval_tradition.rb +26 -0
  92. data/lib/head_music/style/modern_tradition.rb +31 -0
  93. data/lib/head_music/style/renaissance_tradition.rb +26 -0
  94. data/lib/head_music/style/tradition.rb +21 -0
  95. data/lib/head_music/time/clock_position.rb +84 -0
  96. data/lib/head_music/time/conductor.rb +264 -0
  97. data/lib/head_music/time/meter_event.rb +37 -0
  98. data/lib/head_music/time/meter_map.rb +173 -0
  99. data/lib/head_music/time/musical_position.rb +188 -0
  100. data/lib/head_music/time/smpte_timecode.rb +164 -0
  101. data/lib/head_music/time/tempo_event.rb +40 -0
  102. data/lib/head_music/time/tempo_map.rb +187 -0
  103. data/lib/head_music/time.rb +32 -0
  104. data/lib/head_music/utilities/case.rb +27 -0
  105. data/lib/head_music/utilities/hash_key.rb +34 -2
  106. data/lib/head_music/version.rb +1 -1
  107. data/lib/head_music.rb +71 -22
  108. data/user_stories/active/string-pitches.md +41 -0
  109. data/user_stories/backlog/notation-style.md +183 -0
  110. data/user_stories/backlog/organizing-content.md +80 -0
  111. data/user_stories/done/consonance-dissonance-classification.md +117 -0
  112. data/user_stories/{backlog → done}/dyad-analysis.md +6 -16
  113. data/user_stories/done/epic--score-order/PLAN.md +244 -0
  114. data/user_stories/done/expand-playing-techniques.md +38 -0
  115. data/user_stories/done/handle-time.md +7 -0
  116. data/user_stories/done/handle-time.rb +163 -0
  117. data/user_stories/done/instrument-architecture.md +238 -0
  118. data/user_stories/done/instrument-variant.md +65 -0
  119. data/user_stories/done/move-musical-symbol-to-notation.md +161 -0
  120. data/user_stories/done/move-staff-mapping-to-notation.md +158 -0
  121. data/user_stories/done/move-staff-position-to-notation.md +141 -0
  122. data/user_stories/done/notation-module-foundation.md +102 -0
  123. data/user_stories/done/percussion_set.md +260 -0
  124. data/user_stories/done/sonority-identification.md +37 -0
  125. data/user_stories/done/superclass-for-note.md +30 -0
  126. data/user_stories/epics/notation-module.md +135 -0
  127. data/user_stories/visioning/agentic-daw.md +2 -0
  128. metadata +84 -18
  129. data/TODO.md +0 -109
  130. data/check_instrument_consistency.rb +0 -0
  131. data/test_translations.rb +0 -15
  132. data/user_stories/backlog/consonance-dissonance-classification.md +0 -57
  133. data/user_stories/backlog/pitch-set-classification.md +0 -62
  134. data/user_stories/backlog/sonority-identification.md +0 -47
  135. /data/user_stories/{backlog → done/epic--score-order}/band-score-order.md +0 -0
  136. /data/user_stories/{backlog → done/epic--score-order}/chamber-ensemble-score-order.md +0 -0
  137. /data/user_stories/{backlog → done/epic--score-order}/orchestral-score-order.md +0 -0
  138. /data/user_stories/{backlog → done}/pitch-class-set-analysis.md +0 -0
@@ -1,5 +1,11 @@
1
1
  de:
2
2
  head_music:
3
+ alterations:
4
+ sharp: Kreuz
5
+ flat: Be
6
+ natural: Auflösungszeichen
7
+ double_sharp: Doppelkreuz
8
+ double_flat: Doppel-Be
3
9
  chromatic_intervals:
4
10
  perfect_unison: reine Prime
5
11
  minor_second: kleine Sekunde
@@ -153,6 +159,8 @@ de:
153
159
  descant: Diskant
154
160
  didgeridoo: Didgeridoo
155
161
  double_bass: Kontrabass
162
+ drum_kit: Schlagzeug
163
+ floor_tom: Floor-Tom
156
164
  double_contrabass_recorder: Doppelkontrabassblockflöte
157
165
  english_horn: Englischhorn
158
166
  euphonium: Euphonium
@@ -173,6 +181,7 @@ de:
173
181
  harpsichord: Cembalo
174
182
  hautbois_d_amour: Liebeshoboe
175
183
  hi-hat: Hi-Hat
184
+ high_tom: High-Tom
176
185
  horn: Horn
177
186
  kettledrum: Pauke
178
187
  kick_drum: Große Trommel
@@ -184,6 +193,7 @@ de:
184
193
  mezzo: Mezzo
185
194
  mezzo_soprano: Mezzosopran
186
195
  mezzo_soprano_voice: Mezzosopran
196
+ mid_tom: Mid-Tom
187
197
  military_drum: Militärtrommel
188
198
  mouth_organ: Mundharmonika
189
199
  natural_horn: Waldhorn
@@ -272,6 +282,25 @@ de:
272
282
  woodblock: Holzblock
273
283
  xylophone: Xylophon
274
284
  zither: Zither
285
+ instrument_families:
286
+ drum_kit: Schlagzeug
287
+ hi_hat: Hi-Hat
288
+ tom_tom: Tom-Tom
289
+ playing_techniques:
290
+ bell: Glocke
291
+ bow: Bogen
292
+ brush: Bürste
293
+ choked: Erstickt
294
+ closed: Geschlossen
295
+ cross_stick: Querstöckchen
296
+ damped: Gedämpft
297
+ hand: Hand
298
+ let_ring: Ausklingen lassen
299
+ mallet: Schläger
300
+ open: Offen
301
+ pedal: Pedal
302
+ rim_shot: Rimshot
303
+ stick: Stick
275
304
  locales:
276
305
  de: Deutsch
277
306
  en: Englisch
@@ -1,5 +1,11 @@
1
1
  en:
2
2
  head_music:
3
+ alterations:
4
+ sharp: sharp
5
+ flat: flat
6
+ natural: natural
7
+ double_sharp: double sharp
8
+ double_flat: double flat
3
9
  chromatic_intervals:
4
10
  perfect_unison: perfect unison
5
11
  minor_second: minor second
@@ -270,6 +276,7 @@ en:
270
276
  cymbal: cymbal
271
277
  descant: descant
272
278
  didgeridoo: didgeridoo
279
+ drum_kit: drum kit
273
280
  double_bass: double bass
274
281
  double_contrabass_recorder: double-contrabass recorder
275
282
  electronic_keyboard: electronic keyboard
@@ -277,6 +284,7 @@ en:
277
284
  euphonium: euphonium
278
285
  fiddle: fiddle
279
286
  field_drum: field drum
287
+ floor_tom: floor tom
280
288
  flugelhorn: flugelhorn
281
289
  flute: flute
282
290
  fortepiano: fortepiano
@@ -293,6 +301,7 @@ en:
293
301
  harpsichord: harpsichord
294
302
  hautbois_d_amour: hautbois d'amour
295
303
  hi-hat: hi-hat
304
+ high_tom: high tom
296
305
  horn: horn
297
306
  kettledrum: kettledrum
298
307
  kick_drum: kick drum
@@ -304,6 +313,7 @@ en:
304
313
  mezzo: mezzo
305
314
  mezzo_soprano: mezzo-soprano
306
315
  mezzo_soprano_voice: mezzo-soprano
316
+ mid_tom: mid tom
307
317
  military_drum: military drum
308
318
  mouth_organ: mouth_organ
309
319
  natural_horn: natural horn
@@ -391,6 +401,102 @@ en:
391
401
  woodblock: woodblock
392
402
  xylophone: xylophone
393
403
  zither: zither
404
+ instrument_families:
405
+ drum_kit: drum kit
406
+ hi_hat: hi-hat
407
+ tom_tom: tom-tom
408
+ playing_techniques:
409
+ aeolian: aeolian
410
+ air: air
411
+ alla_chitarra: alla chitarra
412
+ arco: arco
413
+ artificial_harmonic: artificial harmonic
414
+ au_talon: au talon
415
+ barre: barré
416
+ bell: bell
417
+ bisbigliando: bisbigliando
418
+ bow: bow
419
+ brush: brush
420
+ bucket_mute: bucket mute
421
+ center: center
422
+ choked: choked
423
+ closed: closed
424
+ col_legno: col legno
425
+ col_legno_battuto: col legno battuto
426
+ col_legno_tratto: col legno tratto
427
+ con_bocca_chiusa: con bocca chiusa
428
+ con_sordino: con sordino
429
+ cross_stick: cross stick
430
+ cuivre: cuivré
431
+ cup_mute: cup mute
432
+ damped: damped
433
+ dead_stroke: dead stroke
434
+ detache: détaché
435
+ edge: edge
436
+ flautando: flautando
437
+ flutter_tongue: flutter tongue
438
+ frullato: frullato
439
+ half_barre: half barré
440
+ hand: hand
441
+ harmonic: harmonic
442
+ jete: jeté
443
+ harmon_mute: harmon mute
444
+ harmon_mute_stem_in: harmon mute stem in
445
+ harmon_mute_stem_out: harmon mute stem out
446
+ key_clicks: key clicks
447
+ laissez_vibrer: laissez vibrer
448
+ left_hand: left hand
449
+ legato: legato
450
+ let_ring: let ring
451
+ mallet: mallet
452
+ marcato: marcato
453
+ martele: martelé
454
+ martellato: martellato
455
+ modo_ordinario: modo ordinario
456
+ motor_off: motor off
457
+ motor_on: motor on
458
+ muffled: muffled
459
+ multiphonic: multiphonic
460
+ natural_harmonic: natural harmonic
461
+ naturale: naturale
462
+ non_laissez_vibrer: non laissez vibrer
463
+ non_vibrato: non vibrato
464
+ open: open
465
+ open_percussion: open
466
+ ordinario: ordinario
467
+ half_pedal: half pedal
468
+ mano_destra: mano destra
469
+ mano_sinistra: mano sinistra
470
+ palm_mute: palm mute
471
+ pedal: pedal
472
+ pizzicato: pizzicato
473
+ plunger_mute: plunger mute
474
+ poco_vibrato: poco vibrato
475
+ punta_d_arco: punta d'arco
476
+ quarter_pedal: quarter pedal
477
+ pres_de_la_table: près de la table
478
+ right_hand: right hand
479
+ rim_shot: rim shot
480
+ saltando: saltando
481
+ senza_sordino: senza sordino
482
+ senza_vibrato: senza vibrato
483
+ slap_tongue: slap tongue
484
+ snares_off: snares off
485
+ snares_on: snares on
486
+ sopra: sopra
487
+ sostenuto_pedal: sostenuto pedal
488
+ sotto: sotto
489
+ spiccato: spiccato
490
+ stick: stick
491
+ stopped: stopped
492
+ straight_mute: straight mute
493
+ sul_ponticello: sul ponticello
494
+ sul_tasto: sul tasto
495
+ three_quarter_pedal: three quarter pedal
496
+ tre_corde: tre corde
497
+ una_corda: una corda
498
+ vibrato: vibrato
499
+ whistle_tone: whistle tone
394
500
  locales:
395
501
  de: German
396
502
  en: English
@@ -1,5 +1,11 @@
1
1
  es:
2
2
  head_music:
3
+ alterations:
4
+ sharp: sostenido
5
+ flat: bemol
6
+ natural: becuadro
7
+ double_sharp: doble sostenido
8
+ double_flat: doble bemol
3
9
  chromatic_intervals:
4
10
  perfect_unison: unísono perfecto
5
11
  minor_second: segunda menor
@@ -149,6 +155,8 @@ es:
149
155
  descant: flauta dulce soprano
150
156
  didgeridoo: didgeridoo
151
157
  double_bass: contrabajo
158
+ drum_kit: batería
159
+ floor_tom: tom de piso
152
160
  double_contrabass_recorder: flauta dulce subcontrabajo
153
161
  english_horn: corno inglés
154
162
  euphonium: euphonium
@@ -170,6 +178,7 @@ es:
170
178
  harpsichord: clavecín
171
179
  hautbois_d_amour: oboe de amor
172
180
  hi-hat: charles
181
+ high_tom: tom agudo
173
182
  horn: corno
174
183
  kettledrum: timbal
175
184
  kick_drum: bombo
@@ -181,6 +190,7 @@ es:
181
190
  mezzo: mezzosoprano
182
191
  mezzo_soprano: mezzosoprano
183
192
  mezzo_soprano_voice: voz de mezzosoprano
193
+ mid_tom: tom grave
184
194
  military_drum: tambor militar
185
195
  mouth_organ: armónica
186
196
  natural_horn: trompa natural
@@ -269,6 +279,25 @@ es:
269
279
  woodblock: bloque de madera
270
280
  xylophone: xilofón
271
281
  zither: cítara
282
+ instrument_families:
283
+ drum_kit: batería
284
+ hi_hat: charles
285
+ tom_tom: tom-tom
286
+ playing_techniques:
287
+ bell: campana
288
+ bow: arco
289
+ brush: cepillo
290
+ choked: apagado
291
+ closed: cerrado
292
+ cross_stick: baqueta inversa
293
+ damped: amortiguado
294
+ hand: mano
295
+ let_ring: dejar sonar
296
+ mallet: baqueta
297
+ open: abierto
298
+ pedal: pedal
299
+ rim_shot: golpe de borde
300
+ stick: baqueta
272
301
  locales:
273
302
  de: alemán
274
303
  en: inglés
@@ -1,5 +1,11 @@
1
1
  fr:
2
2
  head_music:
3
+ alterations:
4
+ sharp: dièse
5
+ flat: bémol
6
+ natural: bécarre
7
+ double_sharp: double dièse
8
+ double_flat: double bémol
3
9
  chromatic_intervals:
4
10
  perfect_unison: unisson parfait
5
11
  minor_second: seconde mineure
@@ -156,6 +162,8 @@ fr:
156
162
  descant: dessus
157
163
  didgeridoo: didgeridoo
158
164
  double_bass: contrebasse
165
+ drum_kit: batterie
166
+ floor_tom: tom de sol
159
167
  double_contrabass_recorder: flûte à bec double-contrebasse
160
168
  english_horn: cor anglais
161
169
  euphonium: euphonium
@@ -177,6 +185,7 @@ fr:
177
185
  harpsichord: clavecin
178
186
  hautbois_d_amour: hautbois d'amour
179
187
  hi-hat: charleston
188
+ high_tom: tom aigu
180
189
  horn: cor
181
190
  kettledrum: timbale
182
191
  kick_drum: grosse caisse
@@ -188,6 +197,7 @@ fr:
188
197
  mezzo: mezzo
189
198
  mezzo_soprano: mezzo-soprano
190
199
  mezzo_soprano_voice: voix de mezzo-soprano
200
+ mid_tom: tom grave
191
201
  military_drum: tambour militaire
192
202
  mouth_organ: harmonica
193
203
  natural_horn: cor naturel
@@ -275,6 +285,25 @@ fr:
275
285
  woodblock: bloc de bois
276
286
  xylophone: xylophone
277
287
  zither: cithare
288
+ instrument_families:
289
+ drum_kit: batterie
290
+ hi_hat: charleston
291
+ tom_tom: tom-tom
292
+ playing_techniques:
293
+ bell: cloche
294
+ bow: archet
295
+ brush: brosse
296
+ choked: étouffé
297
+ closed: fermé
298
+ cross_stick: baguette croisée
299
+ damped: amorti
300
+ hand: main
301
+ let_ring: laisser résonner
302
+ mallet: maillet
303
+ open: ouvert
304
+ pedal: pédale
305
+ rim_shot: coup de bord
306
+ stick: baguette
278
307
  locales:
279
308
  de: allemand
280
309
  en: anglais
@@ -1,5 +1,11 @@
1
1
  it:
2
2
  head_music:
3
+ alterations:
4
+ sharp: diesis
5
+ flat: bemolle
6
+ natural: bequadro
7
+ double_sharp: doppio diesis
8
+ double_flat: doppio bemolle
3
9
  chromatic_intervals:
4
10
  perfect_unison: unisono perfetto
5
11
  minor_second: seconda minore
@@ -151,6 +157,8 @@ it:
151
157
  descant: soprano
152
158
  didgeridoo: didgeridoo
153
159
  double_bass: contrabbasso
160
+ drum_kit: batteria
161
+ floor_tom: tom a terra
154
162
  double_contrabass_recorder: doppio flauto dolce contrabbasso
155
163
  english_horn: corno inglese
156
164
  euphonium: eufonio
@@ -172,6 +180,7 @@ it:
172
180
  harpsichord: clavicembalo
173
181
  hautbois_d_amour: oboe d'amore
174
182
  hi-hat: hi-hat
183
+ high_tom: tom acuto
175
184
  horn: corno
176
185
  kettledrum: timpano
177
186
  kick_drum: grancassa
@@ -183,6 +192,7 @@ it:
183
192
  metal_block: blocco metallico
184
193
  mezzo: mezzosoprano
185
194
  mezzo_soprano_voice: mezzosoprano
195
+ mid_tom: tom grave
186
196
  military_drum: tamburo militare
187
197
  mouth_organ: armonica a bocca
188
198
  natural_horn: corno naturale
@@ -268,6 +278,25 @@ it:
268
278
  woodblock: legnetto
269
279
  xylophone: xilofono
270
280
  zither: cetra da tavolo
281
+ instrument_families:
282
+ drum_kit: batteria
283
+ hi_hat: hi-hat
284
+ tom_tom: tom-tom
285
+ playing_techniques:
286
+ bell: campana
287
+ bow: arco
288
+ brush: spazzola
289
+ choked: soffocato
290
+ closed: chiuso
291
+ cross_stick: bacchetta incrociata
292
+ damped: smorzato
293
+ hand: mano
294
+ let_ring: lasciar vibrare
295
+ mallet: bacchetta
296
+ open: aperto
297
+ pedal: pedale
298
+ rim_shot: colpo di rimshot
299
+ stick: bacchetta
271
300
  locales:
272
301
  de: tedesco
273
302
  en: inglese
@@ -1,5 +1,11 @@
1
1
  ru:
2
2
  head_music:
3
+ alterations:
4
+ sharp: диез
5
+ flat: бемоль
6
+ natural: бекар
7
+ double_sharp: дубль-диез
8
+ double_flat: дубль-бемоль
3
9
  chromatic_intervals:
4
10
  perfect_unison: чистый унисон
5
11
  minor_second: малая секунда
@@ -97,6 +103,8 @@ ru:
97
103
  descant: дискант
98
104
  didgeridoo: диджериду
99
105
  double_bass: контрабас
106
+ drum_kit: барабанная установка
107
+ floor_tom: том для пола
100
108
  double_contrabass_recorder: двойная контрабасовая флейта
101
109
  english_horn: английский рожок
102
110
  euphonium: эуфониум
@@ -118,6 +126,7 @@ ru:
118
126
  harpsichord: клавесин
119
127
  hautbois_d_amour: гобой д'амур
120
128
  hi-hat: хай-хет
129
+ high_tom: том высокий
121
130
  horn: валторна
122
131
  kettledrum: тимпан
123
132
  kick_drum: бас-барабан
@@ -128,6 +137,7 @@ ru:
128
137
  mezzo: меццо
129
138
  mezzo_soprano: меццо-сопрано
130
139
  mezzo_soprano_voice: голос меццо-сопрано
140
+ mid_tom: том средний
131
141
  military_drum: военный барабан
132
142
  mouth_organ: губная гармоника
133
143
  natural_horn: натуральный рог
@@ -215,6 +225,25 @@ ru:
215
225
  woodblock: деревянный блок
216
226
  xylophone: ксилофон
217
227
  zither: цитра
228
+ instrument_families:
229
+ drum_kit: барабанная установка
230
+ hi_hat: хай-хет
231
+ tom_tom: том-том
232
+ playing_techniques:
233
+ bell: колокол
234
+ bow: смычок
235
+ brush: щётка
236
+ choked: задушенный
237
+ closed: закрытый
238
+ cross_stick: крест-стик
239
+ damped: приглушённый
240
+ hand: рука
241
+ let_ring: дать звучать
242
+ mallet: молоточек
243
+ open: открытый
244
+ pedal: педаль
245
+ rim_shot: удар по ободу
246
+ stick: палочка
218
247
  locales:
219
248
  de: Немецкий
220
249
  en: Английский
@@ -1,8 +1,8 @@
1
- # A module for music rudiments
2
- module HeadMusic::Rudiment; end
1
+ # A module for visual music notation
2
+ module HeadMusic::Notation; end
3
3
 
4
4
  # A symbol is a mark or sign that signifies a particular rudiment of music
5
- class HeadMusic::Rudiment::MusicalSymbol
5
+ class HeadMusic::Notation::MusicalSymbol
6
6
  attr_reader :ascii, :unicode, :html_entity
7
7
 
8
8
  def initialize(ascii: nil, unicode: nil, html_entity: nil)
@@ -0,0 +1,70 @@
1
+ # A module for visual music notation
2
+ module HeadMusic::Notation; end
3
+
4
+ # Represents the mapping of an instrument (and optional playing technique) to a staff position
5
+ #
6
+ # @example Basic mapping
7
+ # mapping = StaffMapping.new({
8
+ # "staff_position" => 4,
9
+ # "instrument" => "snare_drum"
10
+ # })
11
+ # mapping.instrument.name #=> "snare drum"
12
+ # mapping.position_index #=> 4
13
+ #
14
+ # @example Mapping with playing technique
15
+ # mapping = StaffMapping.new({
16
+ # "staff_position" => -1,
17
+ # "instrument" => "hi_hat",
18
+ # "playing_technique" => "pedal"
19
+ # })
20
+ # mapping.playing_technique.name #=> "pedal"
21
+ class HeadMusic::Notation::StaffMapping
22
+ attr_reader :staff_position, :instrument_key, :playing_technique_key
23
+
24
+ # Initialize a new StaffMapping
25
+ #
26
+ # @param attributes [Hash] the mapping attributes
27
+ # @option attributes [Integer, String] "staff_position" the staff position index
28
+ # @option attributes [String] "instrument" the instrument key
29
+ # @option attributes [String] "playing_technique" optional playing technique key
30
+ def initialize(attributes)
31
+ @staff_position = HeadMusic::Notation::StaffPosition.new(attributes["staff_position"].to_i)
32
+ @instrument_key = attributes["instrument"]
33
+ @playing_technique_key = attributes["playing_technique"]
34
+ end
35
+
36
+ # Get the Instrument object
37
+ #
38
+ # @return [Instrument, nil] the instrument or nil if not found
39
+ def instrument
40
+ HeadMusic::Instruments::Instrument.get(instrument_key) if instrument_key
41
+ end
42
+
43
+ # Get the PlayingTechnique object
44
+ #
45
+ # @return [PlayingTechnique, nil] the playing technique or nil if not specified
46
+ def playing_technique
47
+ HeadMusic::Instruments::PlayingTechnique.get(playing_technique_key) if playing_technique_key
48
+ end
49
+
50
+ # Get the staff position index
51
+ #
52
+ # @return [Integer] the position index
53
+ def position_index
54
+ staff_position.index
55
+ end
56
+
57
+ # String representation of this mapping
58
+ #
59
+ # @return [String] human-readable description
60
+ # @example
61
+ # mapping.to_s #=> "snare drum at line 3"
62
+ # mapping.to_s #=> "hi hat (pedal) at Space 0"
63
+ def to_s
64
+ parts = []
65
+ parts << (instrument&.name || instrument_key) if instrument_key
66
+ parts << "(#{playing_technique})" if playing_technique_key
67
+ parts << "at #{staff_position}"
68
+ parts.compact.join(" ")
69
+ end
70
+ end
@@ -0,0 +1,62 @@
1
+ # A module for visual music notation
2
+ module HeadMusic::Notation; end
3
+
4
+ class HeadMusic::Notation::StaffPosition
5
+ attr_reader :index # Integer, even = line, odd = space; bottom line = 0
6
+
7
+ NAMES = {
8
+ -2 => ["ledger line below staff"],
9
+ -1 => ["space below staff"],
10
+ 0 => ["bottom line", "line 1"],
11
+ 1 => ["bottom space", "space 1"],
12
+ 2 => ["line 2"],
13
+ 3 => ["space 2"],
14
+ 4 => ["middle line", "line 3"],
15
+ 5 => ["space 3"],
16
+ 6 => ["line 4"],
17
+ 7 => ["space 4"],
18
+ 8 => ["top line", "line 5"],
19
+ 9 => ["space above staff"],
20
+ 10 => ["ledger line above staff"]
21
+ }.freeze
22
+
23
+ # Accepts a name (string or symbol) and returns the corresponding StaffPosition index (integer), or nil if not found
24
+ def self.name_to_index(name)
25
+ NAMES.each do |index, names|
26
+ if names.map { |n|
27
+ HeadMusic::Utilities::Case.to_snake_case(n)
28
+ }.include?(HeadMusic::Utilities::Case.to_snake_case(name))
29
+ return index
30
+ end
31
+ end
32
+ nil
33
+ end
34
+
35
+ def initialize(index)
36
+ @index = index
37
+ end
38
+
39
+ def line?
40
+ index.even?
41
+ end
42
+
43
+ def space?
44
+ index.odd?
45
+ end
46
+
47
+ def line_number
48
+ return nil unless line?
49
+ (index / 2) + 1
50
+ end
51
+
52
+ def space_number
53
+ return nil unless space?
54
+ ((index - 1) / 2) + 1
55
+ end
56
+
57
+ def to_s
58
+ return NAMES[index].first if NAMES.key?(index)
59
+
60
+ line? ? "line #{line_number}" : "space #{space_number}"
61
+ end
62
+ end
@@ -0,0 +1,7 @@
1
+ # A module for visual music notation
2
+ module HeadMusic::Notation; end
3
+
4
+ # Load notation classes
5
+ require "head_music/notation/musical_symbol"
6
+ require "head_music/notation/staff_position"
7
+ require "head_music/notation/staff_mapping"