music-transcription 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,35 +3,22 @@ require 'yaml'
3
3
  module Music
4
4
  module Transcription
5
5
 
6
- # Abstraction of a musical part. Contains start offset, notes, and loudness_profile settings.
6
+ # Abstraction of a musical part. Contains notes and loudness_profile settings.
7
7
  #
8
8
  # @author James Tunnell
9
9
  #
10
- # @!attribute [rw] offset
11
- # @return [Numeric] The offset where the part begins.
12
- #
13
- # @!attribute [rw] notes
10
+ # @!attribute [r] notes
14
11
  # @return [Array] The notes to be played.
15
12
  #
16
- # @!attribute [rw] loudness_profile
13
+ # @!attribute [r] loudness_profile
17
14
  # @return [Profile] The parts loudness_profile profile.
18
15
  #
19
16
  class Part
20
- include Hashmake::HashMakeable
21
- attr_reader :offset, :loudness_profile, :notes
22
-
23
- # hashed-arg specs (for hash-makeable idiom)
24
- ARG_SPECS = {
25
- :offset => arg_spec(:reqd => false, :type => Numeric, :default => 0),
26
- :loudness_profile => arg_spec(:reqd => false, :type => Profile, :validator => ->(a){ a.values_between?(0.0,1.0) }, :default => ->(){ Profile.new(:start_value => 0.5) }),
27
- :notes => arg_spec_array(:reqd => false, :type => Note),
28
- }
17
+ attr_reader :loudness_profile, :notes
29
18
 
30
- # A new instance of Part.
31
- # @param [Hash] args Hashed arguments. Valid optional keys are :loudness_profile,
32
- # :notes, and :offset.
33
- def initialize args = {}
34
- hash_make args, Part::ARG_SPECS
19
+ def initialize notes: [], loudness_profile: Profile.new(0.5)
20
+ @notes = notes
21
+ @loudness_profile = loudness_profile
35
22
  end
36
23
 
37
24
  # Produce an exact copy of the current object
@@ -41,41 +28,13 @@ class Part
41
28
 
42
29
  # Compare the equality of another Part object.
43
30
  def ==(other)
44
- return (@offset == other.offset) &&
45
- (@loudness_profile == other.loudness_profile) &&
46
- (@notes == other.notes)
47
- end
48
-
49
- # Set the start offset of the part.
50
- # @param [Numeric] offset The start offset of the part.
51
- # @raise [ArgumentError] unless offset is a Numeric.
52
- def offset= offset
53
- ARG_SPECS[:offset].validate_value offset
54
- @offset = offset
55
- end
56
-
57
- # Set the loudness_profile Profile.
58
- # @param [Tempo] loudness_profile The Profile for part loudness_profile.
59
- # @raise [ArgumentError] if loudness_profile is not a Profile.
60
- def loudness_profile= loudness_profile
61
- ARG_SPECS[:loudness_profile].validate_value loudness_profile
62
- @loudness_profile = loudness_profile
31
+ return (@notes == other.notes) &&
32
+ (@loudness_profile == other.loudness_profile)
63
33
  end
64
34
 
65
35
  # Duration of part notes.
66
36
  def duration
67
- total_duration = @notes.inject(0) { |sum, note| sum + note.duration }
68
- return @offset + total_duration
69
- end
70
-
71
- # offset where part begins
72
- def start
73
- return @offset
74
- end
75
-
76
- # offset where part ends
77
- def end
78
- return @offset + duration
37
+ return @notes.inject(0) { |sum, note| sum + note.duration }
79
38
  end
80
39
 
81
40
  def transpose pitch_diff
@@ -83,45 +42,12 @@ class Part
83
42
  end
84
43
 
85
44
  def transpose! pitch_diff
86
- @notes.each do |note|
87
- note.transpose! pitch_diff
45
+ @notes[0...-1].each do |note|
46
+ note.transpose_pitches_and_links! pitch_diff
88
47
  end
48
+ @notes[-1].transpose_pitches_only! pitch_diff
89
49
  return self
90
- end
91
- end
92
-
93
- class PartFile < Part
94
- include Hashmake::HashMakeable
95
- attr_reader :file_path
96
-
97
- # hashed-arg specs (for hash-makeable idiom)
98
- ARG_SPECS = {
99
- :file_path => arg_spec(:reqd => true, :type => String, :validator => ->(a){ File.exist? a })
100
- }
101
-
102
- # A new instance of Part.
103
- # @param [Hash] args Hashed arguments. Only valid keys is :file_path.
104
- def initialize args
105
- hash_make args, PartFile::ARG_SPECS
106
-
107
- unless @file_path.nil?
108
- obj = YAML.load_file @file_path
109
-
110
- if obj.is_a?(Part)
111
- super(:offset => obj.offset, :notes => obj.notes, :loudness_profile => obj.loudness_profile)
112
- elsif obj.is_a?(Hash)
113
- super(obj)
114
- else
115
- raise ArgumentError, "Expected a Hash or Part object"
116
- end
117
- end
118
- end
119
-
120
- # Produce an exact copy of the current object
121
- def clone
122
- Marshal.load(Marshal.dump(self))
123
- end
124
-
50
+ end
125
51
  end
126
52
 
127
53
  end
@@ -46,7 +46,6 @@ module Transcription
46
46
  #
47
47
  class Pitch
48
48
  include Comparable
49
- include Hashmake::HashMakeable
50
49
  attr_reader :cents_per_octave, :base_freq, :octave, :semitone, :cent
51
50
 
52
51
  #The default number of semitones per octave is 12, corresponding to
@@ -60,49 +59,40 @@ class Pitch
60
59
  # The default base ferquency is C0
61
60
  DEFAULT_BASE_FREQ = 16.351597831287414
62
61
 
63
- # hashed-arg specs (for hash-makeable idiom)
64
- ARG_SPECS = {
65
- :octave => arg_spec(:reqd => false, :type => Fixnum, :default => 0),
66
- :semitone => arg_spec(:reqd => false, :type => Fixnum, :default => 0),
67
- :cent => arg_spec(:reqd => false, :type => Fixnum, :default => 0),
68
- :base_freq => arg_spec(:reqd => false, :type => Numeric, :validator => ->(a){ a > 0.0 }, :default => DEFAULT_BASE_FREQ)
69
- }
70
-
71
62
  # A new instance of Pitch.
72
- # @param [Hash] args Hashed args. See ARG_SPECS for details.
73
- # @raise [ArgumentError] if any of :octave, :semitone, or :cent is
74
- # not a Fixnum.
75
- def initialize args={}
63
+ # @raise [NonPositiveFrequencyError] if base_freq is not > 0.
64
+ def initialize octave:0, semitone:0, cent:0, base_freq:DEFAULT_BASE_FREQ
76
65
  @cents_per_octave = CENTS_PER_SEMITONE * SEMITONES_PER_OCTAVE
77
- hash_make args
78
- normalize!
79
- end
80
-
81
- # Set @base_freq, which is used with the pitch ratio to produce the
82
- # pitch frequency.
83
- def base_freq= base_freq
84
- ARG_SPECS[:base_freq].validate_value base_freq
85
- @base_freq = base_freq
86
- end
87
-
88
- # Set @octave.
89
- def octave= octave
90
- ARG_SPECS[:octave].validate_value octave
91
66
  @octave = octave
92
- end
93
-
94
- # Set semitone.
95
- def semitone= semitone
96
- ARG_SPECS[:semitone].validate_value semitone
97
67
  @semitone = semitone
98
- end
99
-
100
- # Set @cent.
101
- def cent= cent
102
- ARG_SPECS[:cent].validate_value cent
103
68
  @cent = cent
69
+ raise ValueNonPositiveError if base_freq <= 0
70
+ @base_freq = base_freq
71
+ normalize!
104
72
  end
105
73
 
74
+ ## Set @base_freq, which is used with the pitch ratio to produce the
75
+ ## pitch frequency.
76
+ #def base_freq= base_freq
77
+ # raise NonPositiveFrequencyError if base_freq <= 0
78
+ # @base_freq = base_freq
79
+ #end
80
+ #
81
+ ## Set @octave.
82
+ #def octave= octave
83
+ # @octave = octave
84
+ #end
85
+ #
86
+ ## Set semitone.
87
+ #def semitone= semitone
88
+ # @semitone = semitone
89
+ #end
90
+ #
91
+ ## Set @cent.
92
+ #def cent= cent
93
+ # @cent = cent
94
+ #end
95
+
106
96
  # Return the pitch's frequency, which is determined by multiplying the base
107
97
  # frequency and the pitch ratio. Base frequency defaults to DEFAULT_BASE_FREQ,
108
98
  # but can be set during initialization to something else by specifying the
@@ -191,18 +181,26 @@ class Pitch
191
181
  # Add pitches by adding the total cent count of each.
192
182
  # @param [Pitch] other The pitch object to add.
193
183
  def + (other)
194
- self.class.new :octave => (@octave + other.octave), :semitone => (@semitone + other.semitone), :cent => (@cent + other.cent)
184
+ self.class.new(
185
+ octave: (@octave + other.octave),
186
+ semitone: (@semitone + other.semitone),
187
+ cent: (@cent + other.cent)
188
+ )
195
189
  end
196
190
 
197
191
  # Add pitches by subtracting the total cent count.
198
192
  # @param [Pitch] other The pitch object to subtract.
199
193
  def - (other)
200
- self.class.new :octave => (@octave - other.octave), :semitone => (@semitone - other.semitone), :cent => (@cent - other.cent)
194
+ self.class.new(
195
+ octave: (@octave - other.octave),
196
+ semitone: (@semitone - other.semitone),
197
+ cent: (@cent - other.cent)
198
+ )
201
199
  end
202
200
 
203
201
  # Produce an identical Pitch object.
204
202
  def clone
205
- Marshal.load(Marshal.dump(self))
203
+ Marshal.load(Marshal.dump(self)) # is this cheating?
206
204
  end
207
205
 
208
206
  # Balance out the octave, semitone, and cent count.
@@ -294,4 +292,4 @@ class String
294
292
  return semitone
295
293
  end
296
294
 
297
- end
295
+ end
@@ -4,189 +4,189 @@ module Transcription
4
4
  # Define twelve pitch constants for each octave from octave 0 through 8.
5
5
 
6
6
  # A pitch on octave 0
7
- A0 = Pitch.new :octave => 0, :semitone => 9
7
+ A0 = Pitch.new octave: 0, semitone: 9
8
8
  # Bb pitch on octave
9
- Bb0 = Pitch.new :octave => 0, :semitone => 10
9
+ Bb0 = Pitch.new octave: 0, semitone: 10
10
10
  # B pitch on octave 0
11
- B0 = Pitch.new :octave => 0, :semitone => 11
11
+ B0 = Pitch.new octave: 0, semitone: 11
12
12
 
13
13
  # C pitch on octave 1
14
- C1 = Pitch.new :octave => 1, :semitone => 0
14
+ C1 = Pitch.new octave: 1, semitone: 0
15
15
  # Db pitch on octave 1
16
- Db1 = Pitch.new :octave => 1, :semitone => 1
16
+ Db1 = Pitch.new octave: 1, semitone: 1
17
17
  # E pitch on octave 1
18
- D1 = Pitch.new :octave => 1, :semitone => 2
18
+ D1 = Pitch.new octave: 1, semitone: 2
19
19
  # Eb pitch on octave 1
20
- Eb1 = Pitch.new :octave => 1, :semitone => 3
20
+ Eb1 = Pitch.new octave: 1, semitone: 3
21
21
  # E pitch on octave 1
22
- E1 = Pitch.new :octave => 1, :semitone => 4
22
+ E1 = Pitch.new octave: 1, semitone: 4
23
23
  # F pitch on octave 1
24
- F1 = Pitch.new :octave => 1, :semitone => 5
24
+ F1 = Pitch.new octave: 1, semitone: 5
25
25
  # Gb pitch on octave 1
26
- Gb1 = Pitch.new :octave => 1, :semitone => 6
26
+ Gb1 = Pitch.new octave: 1, semitone: 6
27
27
  # G pitch on octave 1
28
- G1 = Pitch.new :octave => 1, :semitone => 7
28
+ G1 = Pitch.new octave: 1, semitone: 7
29
29
  # Ab pitch on octave 1
30
- Ab1 = Pitch.new :octave => 1, :semitone => 8
30
+ Ab1 = Pitch.new octave: 1, semitone: 8
31
31
  # A pitch on octave 1
32
- A1 = Pitch.new :octave => 1, :semitone => 9
32
+ A1 = Pitch.new octave: 1, semitone: 9
33
33
  # Bb pitch on octave
34
- Bb1 = Pitch.new :octave => 1, :semitone => 10
34
+ Bb1 = Pitch.new octave: 1, semitone: 10
35
35
  # B pitch on octave 1
36
- B1 = Pitch.new :octave => 1, :semitone => 11
36
+ B1 = Pitch.new octave: 1, semitone: 11
37
37
 
38
38
  # C pitch on octave 2
39
- C2 = Pitch.new :octave => 2, :semitone => 0
39
+ C2 = Pitch.new octave: 2, semitone: 0
40
40
  # Db pitch on octave 2
41
- Db2 = Pitch.new :octave => 2, :semitone => 1
41
+ Db2 = Pitch.new octave: 2, semitone: 1
42
42
  # E pitch on octave 2
43
- D2 = Pitch.new :octave => 2, :semitone => 2
43
+ D2 = Pitch.new octave: 2, semitone: 2
44
44
  # Eb pitch on octave 2
45
- Eb2 = Pitch.new :octave => 2, :semitone => 3
45
+ Eb2 = Pitch.new octave: 2, semitone: 3
46
46
  # E pitch on octave 2
47
- E2 = Pitch.new :octave => 2, :semitone => 4
47
+ E2 = Pitch.new octave: 2, semitone: 4
48
48
  # F pitch on octave 2
49
- F2 = Pitch.new :octave => 2, :semitone => 5
49
+ F2 = Pitch.new octave: 2, semitone: 5
50
50
  # Gb pitch on octave 2
51
- Gb2 = Pitch.new :octave => 2, :semitone => 6
51
+ Gb2 = Pitch.new octave: 2, semitone: 6
52
52
  # G pitch on octave 2
53
- G2 = Pitch.new :octave => 2, :semitone => 7
53
+ G2 = Pitch.new octave: 2, semitone: 7
54
54
  # Ab pitch on octave 2
55
- Ab2 = Pitch.new :octave => 2, :semitone => 8
55
+ Ab2 = Pitch.new octave: 2, semitone: 8
56
56
  # A pitch on octave 2
57
- A2 = Pitch.new :octave => 2, :semitone => 9
57
+ A2 = Pitch.new octave: 2, semitone: 9
58
58
  # Bb pitch on octave
59
- Bb2 = Pitch.new :octave => 2, :semitone => 10
59
+ Bb2 = Pitch.new octave: 2, semitone: 10
60
60
  # B pitch on octave 2
61
- B2 = Pitch.new :octave => 2, :semitone => 11
61
+ B2 = Pitch.new octave: 2, semitone: 11
62
62
 
63
63
  # C pitch on octave 3
64
- C3 = Pitch.new :octave => 3, :semitone => 0
64
+ C3 = Pitch.new octave: 3, semitone: 0
65
65
  # Db pitch on octave 3
66
- Db3 = Pitch.new :octave => 3, :semitone => 1
66
+ Db3 = Pitch.new octave: 3, semitone: 1
67
67
  # E pitch on octave 3
68
- D3 = Pitch.new :octave => 3, :semitone => 2
68
+ D3 = Pitch.new octave: 3, semitone: 2
69
69
  # Eb pitch on octave 3
70
- Eb3 = Pitch.new :octave => 3, :semitone => 3
70
+ Eb3 = Pitch.new octave: 3, semitone: 3
71
71
  # E pitch on octave 3
72
- E3 = Pitch.new :octave => 3, :semitone => 4
72
+ E3 = Pitch.new octave: 3, semitone: 4
73
73
  # F pitch on octave 3
74
- F3 = Pitch.new :octave => 3, :semitone => 5
74
+ F3 = Pitch.new octave: 3, semitone: 5
75
75
  # Gb pitch on octave 3
76
- Gb3 = Pitch.new :octave => 3, :semitone => 6
76
+ Gb3 = Pitch.new octave: 3, semitone: 6
77
77
  # G pitch on octave 3
78
- G3 = Pitch.new :octave => 3, :semitone => 7
78
+ G3 = Pitch.new octave: 3, semitone: 7
79
79
  # Ab pitch on octave 3
80
- Ab3 = Pitch.new :octave => 3, :semitone => 8
80
+ Ab3 = Pitch.new octave: 3, semitone: 8
81
81
  # A pitch on octave 3
82
- A3 = Pitch.new :octave => 3, :semitone => 9
82
+ A3 = Pitch.new octave: 3, semitone: 9
83
83
  # Bb pitch on octave
84
- Bb3 = Pitch.new :octave => 3, :semitone => 10
84
+ Bb3 = Pitch.new octave: 3, semitone: 10
85
85
  # B pitch on octave 3
86
- B3 = Pitch.new :octave => 3, :semitone => 11
86
+ B3 = Pitch.new octave: 3, semitone: 11
87
87
 
88
88
  # C pitch on octave 4
89
- C4 = Pitch.new :octave => 4, :semitone => 0
89
+ C4 = Pitch.new octave: 4, semitone: 0
90
90
  # Db pitch on octave 4
91
- Db4 = Pitch.new :octave => 4, :semitone => 1
91
+ Db4 = Pitch.new octave: 4, semitone: 1
92
92
  # E pitch on octave 4
93
- D4 = Pitch.new :octave => 4, :semitone => 2
93
+ D4 = Pitch.new octave: 4, semitone: 2
94
94
  # Eb pitch on octave 4
95
- Eb4 = Pitch.new :octave => 4, :semitone => 3
95
+ Eb4 = Pitch.new octave: 4, semitone: 3
96
96
  # E pitch on octave 4
97
- E4 = Pitch.new :octave => 4, :semitone => 4
97
+ E4 = Pitch.new octave: 4, semitone: 4
98
98
  # F pitch on octave 4
99
- F4 = Pitch.new :octave => 4, :semitone => 5
99
+ F4 = Pitch.new octave: 4, semitone: 5
100
100
  # Gb pitch on octave 4
101
- Gb4 = Pitch.new :octave => 4, :semitone => 6
101
+ Gb4 = Pitch.new octave: 4, semitone: 6
102
102
  # G pitch on octave 4
103
- G4 = Pitch.new :octave => 4, :semitone => 7
103
+ G4 = Pitch.new octave: 4, semitone: 7
104
104
  # Ab pitch on octave 4
105
- Ab4 = Pitch.new :octave => 4, :semitone => 8
105
+ Ab4 = Pitch.new octave: 4, semitone: 8
106
106
  # A pitch on octave 4
107
- A4 = Pitch.new :octave => 4, :semitone => 9
107
+ A4 = Pitch.new octave: 4, semitone: 9
108
108
  # Bb pitch on octave
109
- Bb4 = Pitch.new :octave => 4, :semitone => 10
109
+ Bb4 = Pitch.new octave: 4, semitone: 10
110
110
  # B pitch on octave 4
111
- B4 = Pitch.new :octave => 4, :semitone => 11
111
+ B4 = Pitch.new octave: 4, semitone: 11
112
112
 
113
113
  # C pitch on octave 5
114
- C5 = Pitch.new :octave => 5, :semitone => 0
114
+ C5 = Pitch.new octave: 5, semitone: 0
115
115
  # Db pitch on octave 5
116
- Db5 = Pitch.new :octave => 5, :semitone => 1
116
+ Db5 = Pitch.new octave: 5, semitone: 1
117
117
  # E pitch on octave 5
118
- D5 = Pitch.new :octave => 5, :semitone => 2
118
+ D5 = Pitch.new octave: 5, semitone: 2
119
119
  # Eb pitch on octave 5
120
- Eb5 = Pitch.new :octave => 5, :semitone => 3
120
+ Eb5 = Pitch.new octave: 5, semitone: 3
121
121
  # E pitch on octave 5
122
- E5 = Pitch.new :octave => 5, :semitone => 4
122
+ E5 = Pitch.new octave: 5, semitone: 4
123
123
  # F pitch on octave 5
124
- F5 = Pitch.new :octave => 5, :semitone => 5
124
+ F5 = Pitch.new octave: 5, semitone: 5
125
125
  # Gb pitch on octave 5
126
- Gb5 = Pitch.new :octave => 5, :semitone => 6
126
+ Gb5 = Pitch.new octave: 5, semitone: 6
127
127
  # G pitch on octave 5
128
- G5 = Pitch.new :octave => 5, :semitone => 7
128
+ G5 = Pitch.new octave: 5, semitone: 7
129
129
  # Ab pitch on octave 5
130
- Ab5 = Pitch.new :octave => 5, :semitone => 8
130
+ Ab5 = Pitch.new octave: 5, semitone: 8
131
131
  # A pitch on octave 5
132
- A5 = Pitch.new :octave => 5, :semitone => 9
132
+ A5 = Pitch.new octave: 5, semitone: 9
133
133
  # Bb pitch on octave
134
- Bb5 = Pitch.new :octave => 5, :semitone => 10
134
+ Bb5 = Pitch.new octave: 5, semitone: 10
135
135
  # B pitch on octave 5
136
- B5 = Pitch.new :octave => 5, :semitone => 11
136
+ B5 = Pitch.new octave: 5, semitone: 11
137
137
 
138
138
  # C pitch on octave 6
139
- C6 = Pitch.new :octave => 6, :semitone => 0
139
+ C6 = Pitch.new octave: 6, semitone: 0
140
140
  # Db pitch on octave 6
141
- Db6 = Pitch.new :octave => 6, :semitone => 1
141
+ Db6 = Pitch.new octave: 6, semitone: 1
142
142
  # E pitch on octave 6
143
- D6 = Pitch.new :octave => 6, :semitone => 2
143
+ D6 = Pitch.new octave: 6, semitone: 2
144
144
  # Eb pitch on octave 6
145
- Eb6 = Pitch.new :octave => 6, :semitone => 3
145
+ Eb6 = Pitch.new octave: 6, semitone: 3
146
146
  # E pitch on octave 6
147
- E6 = Pitch.new :octave => 6, :semitone => 4
147
+ E6 = Pitch.new octave: 6, semitone: 4
148
148
  # F pitch on octave 6
149
- F6 = Pitch.new :octave => 6, :semitone => 5
149
+ F6 = Pitch.new octave: 6, semitone: 5
150
150
  # Gb pitch on octave 6
151
- Gb6 = Pitch.new :octave => 6, :semitone => 6
151
+ Gb6 = Pitch.new octave: 6, semitone: 6
152
152
  # G pitch on octave 6
153
- G6 = Pitch.new :octave => 6, :semitone => 7
153
+ G6 = Pitch.new octave: 6, semitone: 7
154
154
  # Ab pitch on octave 6
155
- Ab6 = Pitch.new :octave => 6, :semitone => 8
155
+ Ab6 = Pitch.new octave: 6, semitone: 8
156
156
  # A pitch on octave 6
157
- A6 = Pitch.new :octave => 6, :semitone => 9
157
+ A6 = Pitch.new octave: 6, semitone: 9
158
158
  # Bb pitch on octave
159
- Bb6 = Pitch.new :octave => 6, :semitone => 10
159
+ Bb6 = Pitch.new octave: 6, semitone: 10
160
160
  # B pitch on octave 6
161
- B6 = Pitch.new :octave => 6, :semitone => 11
161
+ B6 = Pitch.new octave: 6, semitone: 11
162
162
 
163
163
  # C pitch on octave 7
164
- C7 = Pitch.new :octave => 7, :semitone => 0
164
+ C7 = Pitch.new octave: 7, semitone: 0
165
165
  # Db pitch on octave 7
166
- Db7 = Pitch.new :octave => 7, :semitone => 1
166
+ Db7 = Pitch.new octave: 7, semitone: 1
167
167
  # E pitch on octave 7
168
- D7 = Pitch.new :octave => 7, :semitone => 2
168
+ D7 = Pitch.new octave: 7, semitone: 2
169
169
  # Eb pitch on octave 7
170
- Eb7 = Pitch.new :octave => 7, :semitone => 3
170
+ Eb7 = Pitch.new octave: 7, semitone: 3
171
171
  # E pitch on octave 7
172
- E7 = Pitch.new :octave => 7, :semitone => 4
172
+ E7 = Pitch.new octave: 7, semitone: 4
173
173
  # F pitch on octave 7
174
- F7 = Pitch.new :octave => 7, :semitone => 5
174
+ F7 = Pitch.new octave: 7, semitone: 5
175
175
  # Gb pitch on octave 7
176
- Gb7 = Pitch.new :octave => 7, :semitone => 6
176
+ Gb7 = Pitch.new octave: 7, semitone: 6
177
177
  # G pitch on octave 7
178
- G7 = Pitch.new :octave => 7, :semitone => 7
178
+ G7 = Pitch.new octave: 7, semitone: 7
179
179
  # Ab pitch on octave 7
180
- Ab7 = Pitch.new :octave => 7, :semitone => 8
180
+ Ab7 = Pitch.new octave: 7, semitone: 8
181
181
  # A pitch on octave 7
182
- A7 = Pitch.new :octave => 7, :semitone => 9
182
+ A7 = Pitch.new octave: 7, semitone: 9
183
183
  # Bb pitch on octave
184
- Bb7 = Pitch.new :octave => 7, :semitone => 10
184
+ Bb7 = Pitch.new octave: 7, semitone: 10
185
185
  # B pitch on octave 7
186
- B7 = Pitch.new :octave => 7, :semitone => 11
186
+ B7 = Pitch.new octave: 7, semitone: 11
187
187
 
188
188
  # C pitch on octave 8
189
- C8 = Pitch.new :octave => 8, :semitone => 0
189
+ C8 = Pitch.new octave: 8, semitone: 0
190
190
 
191
191
  # Contain pitch objects from A0 to C8
192
192
  PITCHES = [