head_music 0.26.3 → 0.27.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: 3224075c2e9f76d778cdbd71942f5bf1496b25c52c56062169824fc3e916f947
4
- data.tar.gz: e272fa27e163ca5ea97ceaed10f9098cb196f2ceb45008a89da7837452df6c6e
3
+ metadata.gz: 4274cb71a70fcab6904e99afc282bb1db756e2a1cce0c1e1e50c601e0e848edf
4
+ data.tar.gz: 47566a6db5b0836686fd789cf2e0b052416a68f8f2ed67b2f6582266a141ea1a
5
5
  SHA512:
6
- metadata.gz: f007ea93b150e2a2f140fadb68d73c978e9ea1481dc0e7590c99f97b5b0fabb9be935adca85b92c86d48179b751aa745fcb81cfa194c7df3d2d0f4ae8282d60f
7
- data.tar.gz: 3176231f3a293e9b482fcd7a6708159ca76ed73e8efbec6947fe5779d42fc97cb7850ec07be2d2ae5460bb0e8b88b7b70576e839c59d070707b2a7bbf7f491f0
6
+ metadata.gz: b85d9dbd114b70bfea1fa9ce8cb964f6780ad9f64325a75baba02df48e416475f33e26a9dab22309740ff6e7f033fca756906a4fd5935af1f22e6fd325a775d4
7
+ data.tar.gz: 60a75acc692a1e1014f6042f9b167ecd7a0f6ec8eb98ca5dccb4c16a9bbcc79deff0b56481a713941caad779b7cc17b8487c89f4b4839bb31e3b453cff7558b5
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # A pitch is a named frequency represented by a spelling and an octive.
3
+ # A pitch is a named frequency represented by a spelling and a register.
4
4
  class HeadMusic::Pitch
5
5
  include Comparable
6
6
 
@@ -108,6 +108,10 @@ class HeadMusic::Pitch
108
108
  midi_note_number
109
109
  end
110
110
 
111
+ def helmholtz_notation
112
+ helmholtz_letter_name + helmholtz_marks
113
+ end
114
+
111
115
  def natural
112
116
  HeadMusic::Pitch.get(to_s.gsub(HeadMusic::Sign.matcher, ''))
113
117
  end
@@ -211,4 +215,14 @@ class HeadMusic::Pitch
211
215
  @target_letter_name ||= {}
212
216
  @target_letter_name[num_steps] ||= letter_name.steps_up(num_steps)
213
217
  end
218
+
219
+ def helmholtz_letter_name
220
+ return spelling.to_s.downcase if HeadMusic::Register.get(register).helmholtz_case == :lower
221
+
222
+ spelling.to_s
223
+ end
224
+
225
+ def helmholtz_marks
226
+ HeadMusic::Register.get(register).helmholtz_marks
227
+ end
214
228
  end
@@ -54,5 +54,18 @@ class HeadMusic::Register
54
54
  self.class.get(to_i - other.to_i)
55
55
  end
56
56
 
57
+ def helmholtz_case
58
+ return :upper if number < 3
59
+
60
+ :lower
61
+ end
62
+
63
+ def helmholtz_marks
64
+ return ',' * (2 - number) if number < 2
65
+ return "'" * (number - 3) if number > 3
66
+
67
+ ''
68
+ end
69
+
57
70
  private_class_method :new
58
71
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HeadMusic
4
- VERSION = '0.26.3'
4
+ VERSION = '0.27.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: head_music
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.3
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Head