head_music 0.24.0 → 0.24.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,63 @@
1
+ de:
2
+ rudiments:
3
+ clef: Notenschlüssel
4
+ consonance: Konsonanz
5
+ clefs:
6
+ alto_clef: Altschlüssel
7
+ baritone_c_clef: Baritonschlüssel
8
+ baritone_clef: Baritonschlüssel
9
+ baritone_f_clef: Baritonschlüssel
10
+ bass_clef: Bassschlüssel
11
+ c_clef: C-Schlüssel
12
+ choral_tenor_clef: oktavierten Violinschlüssel
13
+ contrabass_clef: contrabass clef
14
+ countertenor_clef: countertenor clef
15
+ double_treble_clef: double treble clef
16
+ drum_clef: Schlagzeugschlüssel
17
+ f_clef: F-Schlüssel
18
+ fifth_line_c_clef: fifth-line C-clef
19
+ fifth_line_f_clef: fifth-line F-clef
20
+ first_line_c_clef: Sopranschlüssel
21
+ first_line_g_clef: first-line G-clef
22
+ fourth_line_c_clef: fourth-line C-clef
23
+ fourth_line_f_clef: fourth-line F-clef
24
+ french_clef: French clef
25
+ french_violin_clef: French violin clef
26
+ g_clef: G-Schlüssel
27
+ indefinite_pitch_clef: indefinite pitch clef
28
+ mezzo_soprano_clef: Mezzosopranschlüssel
29
+ neutral_clef: Schlagzeugschlüssel
30
+ percussion_clef: Schlagzeugschlüssel
31
+ second_line_c_clef: second-line C-clef
32
+ second_line_g_clef: second-line G-clef
33
+ soprano_clef: Sopranschlüssel
34
+ sub_bass_clef: Subbassschlüssel
35
+ tenor_c_clef: Tenorschlüssel
36
+ tenor_clef: Tenorschlüssel
37
+ tenor_g_clef: tenor G-clef
38
+ third_line_c_clef: third-line C-clef
39
+ third_line_f_clef: third-line F-clef
40
+ treble_clef: Violinschlüssel
41
+ viola_clef: Bratschenschlüssel
42
+ violin_clef: Violinschlüssel
43
+ reference_pitches:
44
+ chamber_tone: Kammerton
45
+ choir_tone: Chorton
46
+ instruments:
47
+ accordian: Akkordeon
48
+ alto_flute: Altflöte
49
+ alto_voice: Alt
50
+ arpeggione: Arpeggione
51
+ bagpipe: Dudelsack
52
+ baritone_voice: Bariton
53
+ bass_voice: Bass
54
+ bass_clarinet: clarinette basse
55
+ fiddle: Geige
56
+ guitar: Gitarre
57
+ piano: Piano
58
+ viola: Bratsche
59
+ violin: Violine
60
+ instrument_voices:
61
+ alto: Alt
62
+ baritone: Bariton
63
+ bass: Bass
@@ -0,0 +1,198 @@
1
+ en:
2
+ rudiments:
3
+ chromatic_interval: chromatic interval
4
+ circle: circle
5
+ clef: clef
6
+ consonance: consonance
7
+ diatonic_interval: diatonic interval
8
+ grand_staff: grand staff
9
+ harmonic_interval: harmonic interval
10
+ instrument: instrument
11
+ interval_cycle: interval cycle
12
+ key_signature: key signature
13
+ letter_name: letter name
14
+ melodic_interval: melodic interval
15
+ meter: meter
16
+ motion: motion
17
+ musical_symbol: musical symbol
18
+ octave: octave
19
+ pitch: pitch
20
+ pitch_class: pitch class
21
+ pitch_class_set: pitch class set
22
+ pitch_set: pitch set
23
+ quality: quality
24
+ reference_pitch: reference pitch
25
+ rhythm: rhythm
26
+ rhythmic_unit: rhythmic unit
27
+ scale: scale
28
+ scale_degree: scale degree
29
+ scale_type: scale type
30
+ sign: sign
31
+ solmization: solmization
32
+ sonority: sonority
33
+ spelling: spelling
34
+ staff: staff
35
+ tuning: tuning
36
+ clefs:
37
+ alto_clef: alto clef
38
+ baritone_c_clef: baritone C-clef
39
+ baritone_clef: baritone clef
40
+ baritone_f_clef: baritone F-clef
41
+ bass_clef: bass clef
42
+ c_clef: C-clef
43
+ choral_tenor_clef: choral tenor clef
44
+ contrabass_clef: contrabass clef
45
+ countertenor_clef: countertenor clef
46
+ double_treble_clef: double treble clef
47
+ drum_clef: drum clef
48
+ f_clef: F-clef
49
+ fifth_line_c_clef: fifth-line C-clef
50
+ fifth_line_f_clef: fifth-line F-clef
51
+ first_line_c_clef: first-line C-clef
52
+ first_line_g_clef: first-line G-clef
53
+ fourth_line_c_clef: fourth-line C-clef
54
+ fourth_line_f_clef: fourth-line F-clef
55
+ french_clef: French clef
56
+ french_violin_clef: French violin clef
57
+ g_clef: G-clef
58
+ indefinite_pitch_clef: indefinite pitch clef
59
+ mezzo_soprano_clef: mezzo-soprano clef
60
+ neutral_clef: neutral clef
61
+ percussion_clef: percussion clef
62
+ second_line_c_clef: second-line C-clef
63
+ second_line_g_clef: second-line G-clef
64
+ soprano_clef: soprano clef
65
+ sub_bass_clef: sub-bass clef
66
+ tenor_c_clef: tenor C-clef
67
+ tenor_clef: tenor clef
68
+ tenor_g_clef: tenor G-clef
69
+ third_line_c_clef: third-line C-clef
70
+ third_line_f_clef: third-line F-clef
71
+ treble_clef: treble clef
72
+ viola_clef: viola clef
73
+ violin_clef: treble clef
74
+ reference_pitches:
75
+ a440: A440
76
+ baroque: Baroque pitch
77
+ berlin_philharmonic: Berlin Philharmonic
78
+ boston_symphony_orchestra: Boston Symphony Orchestra
79
+ chamber_tone: chamber tone
80
+ choir: choir tone
81
+ classical: classical pitch
82
+ concert: concert pitch
83
+ continental: continental pitch
84
+ french: French pitch
85
+ haydn: Haydn pitch
86
+ high: high pitch
87
+ international: international pitch
88
+ iso_16: ISO 16
89
+ low: low pitch
90
+ mozart: Mozart pitch
91
+ new_philharmonic: new philharmonic pitch
92
+ new_york_philharmonic: New York Philharmonic
93
+ old_philharmonic: old philharmonic pitch
94
+ philosophical: philosophical pitch
95
+ sauveur: Sauveur pitch
96
+ scheibler: Scheibler pitch
97
+ scientific: scientific pitch
98
+ stuttgart: Stuttgart pitch
99
+ sydney_symphony_orchestra: Sydney Symphony Orchestra
100
+ verdi: Verdi tuning
101
+ instruments:
102
+ accordian: accordian
103
+ alto_flute: alto flute
104
+ alto_voice: alto
105
+ arpeggione: arpeggione
106
+ bagpipe: bagpipe
107
+ baritone_voice: baritone
108
+ bass_clarinet: bass clarinet
109
+ bass_drum: bass drum
110
+ bass_guitar: bass guitar
111
+ bass_oboe: bass oboe
112
+ bass_trombone: bass trombone
113
+ bass_tuba: bass tuba
114
+ bass_voice: bass
115
+ bassoon: bassoon
116
+ castanets: castanets
117
+ chimes: chimes
118
+ clarinet: clarinet
119
+ clash_cymbals: clash cymbals
120
+ cornet: cornet
121
+ contrabassoon: contrabassoon
122
+ contra_bass_clarinet: contra bass clarinet
123
+ cor_anglais: cor anglais
124
+ cowbell: cowbell
125
+ cymbal: cymbal
126
+ crotales: crotales
127
+ double_bass: double bass
128
+ english_horn: English horn
129
+ euphonium: euphonium
130
+ flugel_horn: flugel horn
131
+ flute: flute
132
+ french_horn: French horn
133
+ glockenspiel: glockenspiel
134
+ guitar: guitar
135
+ harp: harp
136
+ harpsichord: harpsichord
137
+ mandolin: mandolin
138
+ maracas: maracas
139
+ marimba: marimba
140
+ metal_block: metal block
141
+ oboe: oboe
142
+ piano: piano
143
+ piccolo: piccolo
144
+ piccolo_trumpet: piccolo trumpet
145
+ side_drum: side drum
146
+ suspended_cymbal: suspended cymbal
147
+ synthesizer: synthesizer
148
+ tam_tam: tam-tam
149
+ tambourine: tambourine
150
+ temple_blocks: temple blocks
151
+ tenor_drum: tenor drum
152
+ tenor_trombone: tenor trombone
153
+ timpani: timpani
154
+ triangle: triangle
155
+ trumpet: trumpet
156
+ tuba: tuba
157
+ tubular_bells: tubular bells
158
+ vibraphone: vibraphone
159
+ viola: viola
160
+ violin: violin
161
+ violincello: cello
162
+ woodblock: woodblock
163
+ xylophone: xylophone
164
+ instrument_abbreviations:
165
+ accordian:
166
+ - acc
167
+ alto_flute:
168
+ - afl
169
+ alto_voice:
170
+ - alt
171
+ bagpipe:
172
+ - bag
173
+ baritone_voice:
174
+ - bar
175
+ bass_voice:
176
+ - bass
177
+ bass_clarinet:
178
+ - bcl
179
+ instrument_classifications:
180
+ aerophone: aerophone
181
+ bowed: bowed
182
+ brass: brass
183
+ double_reed: double-reed
184
+ keyboard: keyboard
185
+ percussion: percussion
186
+ single_reed: single-reed
187
+ string: string
188
+ wind: wind
189
+ woodwind: woodwind
190
+ instrument_voices:
191
+ piccolo: piccolo
192
+ soprano: soprano
193
+ alto: alto
194
+ tenor: tenor
195
+ baritone: baritone
196
+ bass: bass
197
+ contrabass: contrabass
198
+ octobass: octobass
@@ -0,0 +1,3 @@
1
+ en_GB:
2
+ rudiments:
3
+ grand_staff: great staff
@@ -0,0 +1,53 @@
1
+ es:
2
+ rudiments:
3
+ clef: clave
4
+ consonance: consonancia
5
+ clefs:
6
+ alto_clef: clave contralto
7
+ baritone_c_clef: clave de barítono
8
+ baritone_clef: clave de barítono
9
+ baritone_f_clef: clave de fa en tercera
10
+ bass_clef: clave de bajo
11
+ c_clef: clave de do
12
+ choral_tenor_clef: choral tenor clef
13
+ contrabass_clef: clave de contrabajo
14
+ countertenor_clef: clave de contratenor
15
+ double_treble_clef: double clave de sol
16
+ drum_clef: clave para percusión
17
+ f_clef: clave de fa
18
+ fifth_line_c_clef: clave de do en quinta
19
+ fifth_line_f_clef: clave de fa en quinta
20
+ first_line_c_clef: clave de do en primera
21
+ first_line_g_clef: clave de sol en primera
22
+ fourth_line_c_clef: clave de do en cuarta
23
+ fourth_line_f_clef: clave de fa en cuarta
24
+ french_clef: clave de sol en primera
25
+ french_violin_clef: clave de sol en primera
26
+ g_clef: clave de sol
27
+ indefinite_pitch_clef: clave neutral
28
+ mezzo_soprano_clef: clave de mezzosoprano
29
+ neutral_clef: clave neutral
30
+ percussion_clef: clave para percusión
31
+ second_line_c_clef: clave de do en segunda
32
+ second_line_g_clef: clave de sol en segunda
33
+ soprano_clef: clave de soprano
34
+ sub_bass_clef: clave de fa en quinta
35
+ tenor_c_clef: clave de do en cuarta
36
+ tenor_clef: clave de tenor
37
+ tenor_g_clef: clave de sol en segunda
38
+ third_line_c_clef: clave de do en tercera
39
+ third_line_f_clef: clave de fa en tercera
40
+ treble_clef: clave de sol
41
+ viola_clef: clave de do
42
+ violin_clef: clave de sol
43
+ instruments:
44
+ accordian: acordeóon
45
+ alto_flute: flauta alto
46
+ alto_voice: contralto
47
+ bagpipe: gaita
48
+ baritone_voice: baritono
49
+ bass_voice: bajo
50
+ guitar: guitarra
51
+ piano: piano
52
+ viola: viola
53
+ violin: violín
@@ -0,0 +1,57 @@
1
+ fr:
2
+ rudiments:
3
+ clef: clé
4
+ clefs:
5
+ alto_clef: clé alto
6
+ baritone_c_clef: clé de baryton
7
+ baritone_clef: clé de baryton
8
+ baritone_f_clef: clé de fa 3e
9
+ bass_clef: clé de basse
10
+ c_clef: clé d'ut
11
+ choral_tenor_clef: choral tenor clef
12
+ contrabass_clef: clé de contrebasse
13
+ countertenor_clef: clé de contre-ténor
14
+ double_treble_clef: double clé de sol
15
+ drum_clef: clé de tambour
16
+ f_clef: clé de fa
17
+ fifth_line_c_clef: clé d'ut 5e
18
+ fifth_line_f_clef: clé de fa 5e
19
+ first_line_c_clef: clé d'ut 1re
20
+ first_line_g_clef: clé de sol 1re
21
+ fourth_line_c_clef: clé d'ut 4e
22
+ fourth_line_f_clef: clé de fa 4e
23
+ french_clef: clé de sol 1re
24
+ french_violin_clef: clé de sol 1re
25
+ g_clef: clé de sol
26
+ indefinite_pitch_clef: clé à pas indéfini
27
+ mezzo_soprano_clef: clé de mezzo-soprano
28
+ neutral_clef: clé neutre
29
+ percussion_clef: clé de percussion
30
+ second_line_c_clef: clé d'ut 2e
31
+ second_line_g_clef: clé de sol 2e
32
+ soprano_clef: clé de soprano
33
+ sub_bass_clef: clé de fa 5e
34
+ tenor_c_clef: clé d'ut 4e
35
+ tenor_clef: clé de ténor
36
+ tenor_g_clef: clé de sol 2e
37
+ third_line_c_clef: clé d'ut 3e
38
+ third_line_f_clef: clé de fa 3e
39
+ treble_clef: clé de sol
40
+ viola_clef: clé d'ut
41
+ violin_clef: clé de sol
42
+ instruments:
43
+ accordian: accordéon
44
+ alto_flute: flûte alto
45
+ alto_voice: alto
46
+ bagpipe: cornemuse
47
+ baritone_voice: baryton
48
+ bass_clarinet: clarinette basse
49
+ bass_voice: basse
50
+ piano: piano
51
+ viola: alto
52
+ violin: violon
53
+ instrument_voices:
54
+ alto: alto
55
+ baritone: baryton
56
+ bass: basse
57
+ guitar: guitare
@@ -0,0 +1,58 @@
1
+ it:
2
+ rudiments:
3
+ clef: chiave
4
+ consonance: consonanza
5
+ clefs:
6
+ alto_clef: chiave di contralto
7
+ baritone_c_clef: chiave di baritono
8
+ baritone_clef: chiave di baritono
9
+ baritone_f_clef: chiave di baritono
10
+ bass_clef: chiave di basso
11
+ c_clef: chiave di do
12
+ choral_tenor_clef: chiave di sol in ottava
13
+ contrabass_clef: chiave di contrabbasso
14
+ countertenor_clef: chiave di controtenore
15
+ double_treble_clef: chiave di sol in ottava
16
+ drum_clef: chiave di percussione
17
+ f_clef: chiave di fa
18
+ fifth_line_c_clef: chiave di do sulla 5ª linea
19
+ fifth_line_f_clef: chiave di fa sulla 5ª linea
20
+ first_line_c_clef: chiave di do sulla 1ª linea
21
+ first_line_g_clef: chiave di sol sulla 1ª linea
22
+ fourth_line_c_clef: chiave di do sulla 4ª linea
23
+ fourth_line_f_clef: chiave di fa sulla 4ª linea
24
+ french_clef: chiave di violino francese
25
+ french_violin_clef: chiave di violino francese
26
+ g_clef: chiave di sol
27
+ indefinite_pitch_clef: chiave neutra
28
+ mezzo_soprano_clef: chiave di mezzosoprano
29
+ neutral_clef: chiave neutra
30
+ percussion_clef: chiave di percussione
31
+ second_line_c_clef: chiave di do sulla 2ª linea
32
+ second_line_g_clef: chiave di sol sulla 2ª linea
33
+ soprano_clef: chiave di soprano
34
+ sub_bass_clef: chiave di subbasso
35
+ tenor_c_clef: chiave di tenore
36
+ tenor_clef: chiave di tenore
37
+ tenor_g_clef: chiave di sol in ottava
38
+ third_line_c_clef: chiave di do sulla 3ª linea
39
+ third_line_f_clef: chiave di fa sulla 3ª linea
40
+ treble_clef: chiave di violino
41
+ viola_clef: chiave di viola
42
+ violin_clef: chiave di violino
43
+ instruments:
44
+ accordian: fisarmonica
45
+ alto_flute: flauto contralto
46
+ alto_voice: contralto
47
+ bagpipe: cornamusa
48
+ baritone_voice: baritono
49
+ bass_voice: basso
50
+ guitar: chitarra
51
+ piccolo: ottavino
52
+ piano: piano
53
+ viola: viola
54
+ violin: violino
55
+ instrument_voices:
56
+ alto: contralto
57
+ baritone: baritono
58
+ bass: basso
@@ -2,44 +2,111 @@
2
2
 
3
3
  # NameRudiment is a module to be included in classes whose instances may be identified by name.
4
4
  module HeadMusic::Named
5
- attr_reader :name
6
5
  delegate :to_s, to: :name
7
6
 
8
- def initialize(name)
9
- @name = name.to_s
10
- end
7
+ # Locale encapsulates a language and optional region or country.
8
+ class Locale
9
+ DEFAULT_CODE = :en_US
11
10
 
12
- def hash_key
13
- HeadMusic::Utilities::HashKey.for(name)
11
+ attr_reader :language, :region
12
+
13
+ def self.default_locale
14
+ get(DEFAULT_CODE)
15
+ end
16
+
17
+ def self.get(code)
18
+ @locales ||= {}
19
+ parts = code.to_s.split(/[_\-]/)
20
+ language = parts[0].downcase
21
+ region = parts[1]&.upcase
22
+ key = [language, region].compact.join('_').to_sym
23
+ @locales[key] ||= new(language: language, region: region)
24
+ end
25
+
26
+ def initialize(language:, region: nil)
27
+ @language = language
28
+ @region = region
29
+ end
30
+
31
+ def code
32
+ @code ||= [@language, @region].compact.join('_')
33
+ end
34
+
35
+ private_class_method :new
14
36
  end
15
37
 
16
- def self.included(base)
17
- base.extend(ClassMethods)
38
+ # A LocalizedName is the name of a rudiment in a locale.
39
+ class LocalizedName
40
+ attr_reader :locale, :name, :abbreviation
41
+
42
+ delegate :code, to: :locale, prefix: true
43
+ delegate :language, :region, to: :locale
44
+
45
+ def initialize(name:, locale_code: Locale::DEFAULT_CODE, abbreviation: nil)
46
+ @name = name
47
+ @locale = Locale.get(locale_code)
48
+ @abbreviation = abbreviation
49
+ end
18
50
  end
19
51
 
20
52
  # Adds .get_by_name to the including class.
21
53
  module ClassMethods
22
54
  def get_by_name(name)
23
55
  name = name.to_s
24
- @instances_by_name ||= {}
56
+ @instances ||= {}
25
57
  key = HeadMusic::Utilities::HashKey.for(name)
26
- @instances_by_name[key] ||= new(name)
58
+ @instances[key] ||= new(name)
27
59
  end
60
+ end
28
61
 
29
- def aliases
30
- {}
31
- end
62
+ def self.included(base)
63
+ base.extend(ClassMethods)
32
64
  end
33
65
 
34
- # An Alias encapsulates an alternative name for a rudiment.
35
- class Alias
36
- attr_reader :key, :name, :abbreviation, :locale
66
+ attr_reader :name_key, :alias_name_keys
37
67
 
38
- def initialize(key:, name:, abbreviation: nil, locale: nil)
39
- @key = key
40
- @name = name
41
- @abbreviation = abbreviation
42
- @locale = locale
43
- end
68
+ def name=(name)
69
+ ensure_localized_name(name: name)
70
+ end
71
+
72
+ def name(locale_code: Locale::DEFAULT_CODE)
73
+ localized_name(locale_code: locale_code)&.name
74
+ end
75
+
76
+ def localized_name(locale_code: Locale::DEFAULT_CODE)
77
+ locale = Locale.get(locale_code || Locale::DEFAULT_CODE)
78
+ localized_name_in_matching_locale(locale) ||
79
+ localized_name_in_locale_matching_language(locale) ||
80
+ localized_name_in_default_locale ||
81
+ localized_names.first
82
+ end
83
+
84
+ def ensure_localized_name(name:, locale_code: Locale::DEFAULT_CODE, abbreviation: nil)
85
+ @localized_names ||= []
86
+ @localized_names << LocalizedName.new(name: name, locale_code: locale_code, abbreviation: abbreviation)
87
+ @localized_names.uniq!
88
+ end
89
+
90
+ # Returns an array of LocalizedName instances that are synonymous with the name.
91
+ def localized_names
92
+ @localized_names ||= []
93
+ end
94
+
95
+ private
96
+
97
+ def localized_name_in_matching_locale(locale)
98
+ localized_names.detect { |candidate| candidate.locale_code == locale.code }
99
+ end
100
+
101
+ def localized_name_in_locale_matching_language(locale)
102
+ localized_names.detect { |candidate| candidate.language == locale.language }
103
+ end
104
+
105
+ def localized_name_in_default_locale
106
+ localized_names.detect { |name| name.locale_code == Locale::DEFAULT_CODE }
107
+ end
108
+
109
+ def hash_key
110
+ HeadMusic::Utilities::HashKey.for(name)
44
111
  end
45
112
  end