head_music 0.29.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ff9ff67c1a33423b012f970f7e5ff244f44fa05c07315cd248d47d206489369
4
- data.tar.gz: f94cc84e2c2805f22a1e4f4f08f09182f65c639b7052db18149c1acab3788161
3
+ metadata.gz: b2535794cd693b001994fe5a74a815c48e6390d98b89ced86ae7102893017e62
4
+ data.tar.gz: ca961916aa2fd55b1ad8b4ed4cc63aa73e16c28c8ac7affa8670a2eaf4056116
5
5
  SHA512:
6
- metadata.gz: f34e8f37402764fb6b1dfe407821a4dd0e7ff3f382b0d33319c3c9c958635df312c7cf7b27fdfe35f68795eb8bfd60457d38b2168ff9910dd60f51bb29ad36df
7
- data.tar.gz: 12dc1f950956cdf792beb0c530ed78a2cd9301328056d97052566902324b63c21e15cf1a23774d88620a73f7fe0ea42acb593be74ab13915aa16063dd58f6f1d
6
+ metadata.gz: bec7c67bcdb2f5e7181a3d84d54365ec905e604cde2e3653198a65121cd457f6df79162e2db63499f93e6b02b4e18d34eefa89642b91cea66ea075cd6bc20b82
7
+ data.tar.gz: a09572d7bee318937385ecbda3b9a5fd98b3713b7bec57dccd4c8d969ed3c7e710446ea4a5490cb632284e3626948849bee8e5a6a710fba6d74ddb53e2f4b781
data/.rubocop.yml CHANGED
@@ -27,6 +27,3 @@ RSpec/ContextWording:
27
27
 
28
28
  RSpec/NestedGroups:
29
29
  Max: 4
30
-
31
- RSpec/FilePath:
32
- Enabled: false
data/TODO.md CHANGED
@@ -1,5 +1,108 @@
1
1
  # TODO
2
2
 
3
+ May 7, 2023
4
+
5
+ Robert Head:
6
+ Hey, Brian. You have a sec for a music question? I’m trying to come up with different terms for the way “family” is used. “Woodwind family” vs. “Oboe family”.
7
+
8
+ Brian Head:
9
+ Those are good, I’d say. In what context?
10
+
11
+ Robert Head:
12
+ In my software project, I’m trying to define those relationships. One is a section of the orchestra and the other is species of instrument. But usually people, in my experience, just say “family”.
13
+ Is there some more precise terminology or adjective that can disambiguate those two terms?
14
+
15
+ Brian Head:
16
+ Hmmm. Already “family” is informal. Blatter distinguishes between “choir” and “family” as in the trumpet family” within the “brass choir”.
17
+
18
+ Robert Head:
19
+ Ah, yes! I do like that.
20
+ But does it apply to percussion?
21
+ “Section” is another candidate, but that gets used for string parts as well.
22
+
23
+ Brian Head:
24
+ Strings and percussion probably don’t think of themselves as a choir, but if you’re mainly looking for a taxonomically consistent word, that’s the feat I can think of at the moment.
25
+ Section is a good word, too, which easily flows between smaller and larger meanings.
26
+
27
+ Robert Head:
28
+ Obviously, the four “families” is a garbage way to classify all instruments and it really is more applicable to the orchestral context, so maybe “orchestra family” or “orchestra section”.
29
+
30
+ Brian Head:
31
+ I’d say that “family” is best used at the instrument level, as in “saxophone family”. Choir or section are better for larger collections. Still, both of those words connote membership in an orchestra. Or large ensemble. “Woodwinds” or “percussion” describe the class of instruments themselves.
32
+
33
+ Robert Head:
34
+ Cool
35
+
36
+ Action Item: Call them orchestra_section
37
+
38
+ Add Score Order
39
+
40
+ Orchestral Score Order
41
+
42
+ # So, in orchestral scores, the groupings are by instrumental 'family':
43
+ # woodwinds on top of the page, and below them, in descending order,
44
+ # brass,
45
+ # percussion,
46
+ # harp and keyboards,
47
+ # soloists (instrumental or vocal),
48
+ # voices,
49
+ # strings
50
+
51
+ (Notice the different placement of percussion in orchestra and band scores)
52
+ Flutes (Fl or Fls)
53
+ Oboes (Ob or Obs)
54
+ Clarinets (Cl or Cls)
55
+ Bassoons (Bsn or Bsns)
56
+ Horns (Hn or Hns)
57
+ Trumpets (Tpt or Tpts)
58
+ Trombones (Trb or Trbs)
59
+ Tuba (Tuba)
60
+ Timpani (Timp)
61
+ Percussion (Perc)
62
+ Other Instruments
63
+ harp and keyboards
64
+ soloists
65
+ voices
66
+ Violins I (Vlns)
67
+ Violins II
68
+ Viola (Vla)
69
+ Violoncellos (Vcl)
70
+ Double Bass (DB)
71
+
72
+ Band Score Order
73
+
74
+ Flutes (Fl or Fls)
75
+ Oboes (Ob or Obs)
76
+ Bassoons (Bsn or Bsns)
77
+ Clarinets (Cl or Cls)
78
+ Saxophones (AS, or TS, or BS)
79
+ Cornets (Cor)
80
+ Trumpets (Tpt or Tpts)
81
+ Horns (Hn or Hns)
82
+ Trombones (Trb or Trbs)
83
+ Euphoniums (Euph)
84
+ Tubas (Tubas)
85
+ Timpani (Timp)
86
+ Percussion (Perc)
87
+
88
+ Brass Quintet
89
+
90
+ Trumpet I
91
+ Trumpet II
92
+ Horn
93
+ Trombone
94
+ Tuba
95
+
96
+ Woodwind Quintet
97
+
98
+ Flute
99
+ Oboe
100
+ Clarinet
101
+ Horn
102
+ Bassoon
103
+
104
+
105
+
3
106
  Disambiguate PitchSet and Sonority
4
107
 
5
108
  Sonority should be a name for a specific set of intervals
@@ -31,11 +134,12 @@ Make new analysis classes:
31
134
  Dyad
32
135
  .interval
33
136
  .implied_triad (if a third)
137
+ - returns most likely of possible triads
34
138
  .possible_triads
35
139
  - returns major and minor if a perfect fifth
36
140
  - returns minor and diminished if minor third
37
141
  - returns major and augmented if major third
38
- - returns augmented if augmented fifth
142
+ - returns inverted major and root augmented if augmented fifth
39
143
  - returns diminished if diminished fifth
40
144
  - should it take into account enharmonics? I think yes.
41
145
  .possible_seventh_chords
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # A module for musical content
4
+ module HeadMusic::Content; end
5
+
3
6
  # Representation of a bar in a composition
4
7
  # Encapsulates meter and key signature changes
5
- class HeadMusic::Bar
8
+ class HeadMusic::Content::Bar
6
9
  attr_reader :composition
7
10
  attr_accessor :key_signature, :meter
8
11
 
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # A module for musical content
4
+ module HeadMusic::Content; end
5
+
3
6
  # A composition is musical content.
4
- class HeadMusic::Composition
7
+ class HeadMusic::Content::Composition
5
8
  attr_reader :name, :key_signature, :meter, :voices
6
9
 
7
10
  def initialize(name: nil, key_signature: nil, meter: nil)
@@ -10,7 +13,7 @@ class HeadMusic::Composition
10
13
  end
11
14
 
12
15
  def add_voice(role: nil)
13
- @voices << HeadMusic::Voice.new(composition: self, role: role)
16
+ @voices << HeadMusic::Content::Voice.new(composition: self, role: role)
14
17
  @voices.last
15
18
  end
16
19
 
@@ -27,7 +30,7 @@ class HeadMusic::Composition
27
30
  def bars(last = latest_bar_number)
28
31
  @bars ||= []
29
32
  (earliest_bar_number..last).each do |bar_number|
30
- @bars[bar_number] ||= HeadMusic::Bar.new(self)
33
+ @bars[bar_number] ||= HeadMusic::Content::Bar.new(self)
31
34
  end
32
35
  @bars[earliest_bar_number..last]
33
36
  end
@@ -1,22 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # A module for musical content
4
+ module HeadMusic::Content; end
5
+
3
6
  # A note is a pitch with a duration.
4
7
  #
5
8
  # Note quacks like a placement, but requires a different set of construction arguments
6
9
  # - always has a pitch
7
10
  # - receives a voice and position if unspecified
8
- class HeadMusic::Note
11
+ class HeadMusic::Content::Note
9
12
  attr_accessor :pitch, :rhythmic_value, :voice, :position
10
13
 
11
14
  def initialize(pitch, rhythmic_value, voice = nil, position = nil)
12
15
  @pitch = HeadMusic::Pitch.get(pitch)
13
- @rhythmic_value = HeadMusic::RhythmicValue.get(rhythmic_value)
14
- @voice = voice || HeadMusic::Voice.new
15
- @position = position || HeadMusic::Position.new(@voice.composition, "1:1")
16
+ @rhythmic_value = HeadMusic::Content::RhythmicValue.get(rhythmic_value)
17
+ @voice = voice || HeadMusic::Content::Voice.new
18
+ @position = position || HeadMusic::Content::Position.new(@voice.composition, "1:1")
16
19
  end
17
20
 
18
21
  def placement
19
- @placement ||= HeadMusic::Placement.new(voice, position, rhythmic_value, pitch)
22
+ @placement ||= HeadMusic::Content::Placement.new(voice, position, rhythmic_value, pitch)
20
23
  end
21
24
 
22
25
  def to_s
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # A module for musical content
4
+ module HeadMusic::Content; end
5
+
3
6
  # A placement is a note or rest at a position within a voice in a composition
4
- class HeadMusic::Placement
7
+ class HeadMusic::Content::Placement
5
8
  include Comparable
6
9
 
7
10
  attr_reader :voice, :position, :rhythmic_value, :pitch
@@ -54,15 +57,15 @@ class HeadMusic::Placement
54
57
  def ensure_attributes(voice, position, rhythmic_value, pitch)
55
58
  @voice = voice
56
59
  ensure_position(position)
57
- @rhythmic_value = HeadMusic::RhythmicValue.get(rhythmic_value)
60
+ @rhythmic_value = HeadMusic::Content::RhythmicValue.get(rhythmic_value)
58
61
  @pitch = HeadMusic::Pitch.get(pitch)
59
62
  end
60
63
 
61
64
  def ensure_position(position)
62
- @position = if position.is_a?(HeadMusic::Position)
65
+ @position = if position.is_a?(HeadMusic::Content::Position)
63
66
  position
64
67
  else
65
- HeadMusic::Position.new(composition, position)
68
+ HeadMusic::Content::Position.new(composition, position)
66
69
  end
67
70
  end
68
71
  end
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # A module for musical content
4
+ module HeadMusic::Content; end
5
+
3
6
  # A position is a moment in time within the rhythmic framework of a composition.
4
- class HeadMusic::Position
7
+ class HeadMusic::Content::Position
5
8
  include Comparable
6
9
 
7
10
  attr_reader :composition, :bar_number, :count, :tick
@@ -56,7 +59,7 @@ class HeadMusic::Position
56
59
  end
57
60
 
58
61
  def +(other)
59
- other = HeadMusic::RhythmicValue.new(other) if [HeadMusic::RhythmicUnit, Symbol, String].include?(other.class)
62
+ other = HeadMusic::Content::RhythmicValue.new(other) if [HeadMusic::RhythmicUnit, Symbol, String].include?(other.class)
60
63
  self.class.new(composition, bar_number, count, tick + other.ticks)
61
64
  end
62
65
 
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # A module for musical content
4
+ module HeadMusic::Content; end
5
+
3
6
  # A rhythmic value is a duration composed of a rhythmic unit, any number of dots, and a tied value.
4
- class HeadMusic::RhythmicValue
7
+ class HeadMusic::Content::RhythmicValue
5
8
  attr_reader :unit, :dots, :tied_value
6
9
 
7
10
  delegate :name, to: :unit, prefix: true
@@ -9,7 +12,7 @@ class HeadMusic::RhythmicValue
9
12
 
10
13
  def self.get(identifier)
11
14
  case identifier
12
- when HeadMusic::RhythmicValue
15
+ when HeadMusic::Content::RhythmicValue
13
16
  identifier
14
17
  when HeadMusic::RhythmicUnit
15
18
  new(identifier)
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # A module for musical content
4
+ module HeadMusic::Content; end
5
+
3
6
  # A Voice is a stream of music with some indepedence that is conceptually one part or for one performer.
4
7
  # The melodic lines in counterpoint are each a voice.
5
- class HeadMusic::Voice
8
+ class HeadMusic::Content::Voice
6
9
  include Comparable
7
10
 
8
11
  attr_reader :composition, :placements, :role
@@ -10,13 +13,13 @@ class HeadMusic::Voice
10
13
  delegate :key_signature, to: :composition
11
14
 
12
15
  def initialize(composition: nil, role: nil)
13
- @composition = composition || HeadMusic::Composition.new
16
+ @composition = composition || HeadMusic::Content::Composition.new
14
17
  @role = role
15
18
  @placements = []
16
19
  end
17
20
 
18
21
  def place(position, rhythmic_value, pitch = nil)
19
- HeadMusic::Placement.new(self, position, rhythmic_value, pitch).tap do |placement|
22
+ HeadMusic::Content::Placement.new(self, position, rhythmic_value, pitch).tap do |placement|
20
23
  insert_into_placements(placement)
21
24
  end
22
25
  end
@@ -22,10 +22,12 @@
22
22
  - :pitch: G3
23
23
  :line: 2
24
24
  :modern: true
25
- :name_key: choral_tenor_clef
25
+ :name_key: vocal_tenor_clef
26
26
  :alias_name_keys:
27
27
  - tenor_clef
28
28
  - tenor_g_clef
29
+ - g_clef_ottava_bassa
30
+ - octave_treble_clef
29
31
  :symbols:
30
32
  - :unicode: "\U0001D120"
31
33
  :html_entity: "&#119072;"
@@ -0,0 +1,229 @@
1
+ ---
2
+ accordian:
3
+ classification_keys:
4
+ - reed
5
+ - free-reed
6
+ - aerophone
7
+ - keyboard
8
+ - wind
9
+ orchestra_section_key: keyboard
10
+ bagpipe:
11
+ classification_keys:
12
+ - aerophone
13
+ - reed
14
+ - wind
15
+ - woodwind
16
+ orchestra_section_key: woodwind
17
+ bassoon:
18
+ classification_keys:
19
+ - aerophone
20
+ - reed
21
+ - double_reed
22
+ - wind
23
+ - woodwind
24
+ orchestra_section_key: woodwind
25
+ clarinet:
26
+ classification_keys:
27
+ - aerophone
28
+ - reed
29
+ - single_reed
30
+ - wind
31
+ - woodwind
32
+ orchestra_section_key: woodwind
33
+ clavichord:
34
+ classification_keys:
35
+ - chordophone
36
+ - keyboard
37
+ - percussion
38
+ - string
39
+ orchestra_section_key: keyboard
40
+ cornet:
41
+ classification_keys:
42
+ - aerophone
43
+ - brass
44
+ - wind
45
+ orchestra_section_key: brass
46
+ cymbal:
47
+ classification_keys:
48
+ - percussion
49
+ - idiophone
50
+ orchestra_section_key: percussion
51
+ double_bass:
52
+ classification_keys:
53
+ - bowed
54
+ - chordophone
55
+ - string
56
+ orchestra_section_key: string
57
+ flute:
58
+ classification_keys:
59
+ - aerophone
60
+ - edge-blown aerophone
61
+ - wind
62
+ - woodwind
63
+ orchestra_section_key: woodwind
64
+ glockenspiel:
65
+ classification_keys:
66
+ - percussion
67
+ - idiophone
68
+ - keyboard
69
+ - struck
70
+ - metal
71
+ - mallet
72
+ orchestra_section_key: percussion
73
+ gong:
74
+ classification_keys:
75
+ - percussion
76
+ - idiophone
77
+ orchestra_section_key: percussion
78
+ guitar:
79
+ classification_keys:
80
+ - chordophone
81
+ - plucked
82
+ - string
83
+ orchestra_section_key: string
84
+ harp:
85
+ classification_keys:
86
+ - chordophone
87
+ - plucked
88
+ - string
89
+ orchestra_section_key: string
90
+ harpsichord:
91
+ classification_keys:
92
+ - chordophone
93
+ - keyboard
94
+ - percussion
95
+ - string
96
+ orchestra_section_key: keyboard
97
+ horn:
98
+ classification_keys:
99
+ - aerophone
100
+ - brass
101
+ - wind
102
+ orchestra_section_key: brass
103
+ kettledrum:
104
+ classification_keys:
105
+ - percussion
106
+ - membranophone
107
+ orchestra_section_key: percussion
108
+ lute:
109
+ classification_keys:
110
+ - chordophone
111
+ - plucked
112
+ - string
113
+ orchestra_section_key: string
114
+ mandolin:
115
+ classification_keys:
116
+ - chordophone
117
+ - plucked
118
+ - string
119
+ orchestra_section_key: string
120
+ marimba:
121
+ classification_keys:
122
+ - idiophone
123
+ - keyboard
124
+ - percussion
125
+ - struck
126
+ - wood
127
+ - mallet
128
+ orchestra_section_key: percussion
129
+ oboe:
130
+ classification_keys:
131
+ - aerophone
132
+ - reed
133
+ - double_reed
134
+ - wind
135
+ - woodwind
136
+ orchestra_section_key: woodwind
137
+ organ:
138
+ classification_keys:
139
+ - aerophone
140
+ - keyboard
141
+ orchestra_section_key: keyboard
142
+ piano:
143
+ classification_keys:
144
+ - chordophone
145
+ - keyboard
146
+ - percussion
147
+ - string
148
+ orchestra_section_key: keyboard
149
+ recorder:
150
+ classification_keys:
151
+ - aerophone
152
+ - wind
153
+ - woodwind
154
+ orchestra_section_key: woodwind
155
+ saxhorn:
156
+ classification_keys:
157
+ - aerophone
158
+ - brass
159
+ - wind
160
+ orchestra_section_key: brass
161
+ saxophone:
162
+ classification_keys:
163
+ - aerophone
164
+ - reed
165
+ - single_reed
166
+ - wind
167
+ - woodwind
168
+ snare_drum:
169
+ classification_keys:
170
+ - percussion
171
+ - membranophone
172
+ orchestra_section_key: percussion
173
+ synthesizer:
174
+ classification_keys:
175
+ - electronic
176
+ - keyboard
177
+ orchestra_section_key: keyboard
178
+ trombone:
179
+ classification_keys:
180
+ - aerophone
181
+ - brass
182
+ - wind
183
+ orchestra_section_key: brass
184
+ trumpet:
185
+ classification_keys:
186
+ - aerophone
187
+ - brass
188
+ - wind
189
+ orchestra_section_key: brass
190
+ tuba:
191
+ classification_keys:
192
+ - aerophone
193
+ - brass
194
+ - wind
195
+ orchestra_section_key: brass
196
+ vibraphone:
197
+ classification_keys:
198
+ - percussion
199
+ - struck
200
+ - idiophone
201
+ - keyboard
202
+ - mallet
203
+ - metal
204
+ orchestra_section_key: percussion
205
+ violin:
206
+ classification_keys:
207
+ - bowed
208
+ - chordophone
209
+ - string
210
+ orchestra_section_key: string
211
+ voice:
212
+ classification_keys:
213
+ - voice
214
+ orchestra_section_key: voice
215
+ woodblock:
216
+ classification_keys:
217
+ - percussion
218
+ - struck
219
+ - idiophone
220
+ orchestra_section_key: percussion
221
+ xylophone:
222
+ classification_keys:
223
+ - percussion
224
+ - struck
225
+ - idiophone
226
+ - keyboard
227
+ - mallet
228
+ - wood
229
+ orchestra_section_key: percussion