mtk 0.0.3.3 → 0.4
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.
- checksums.yaml +15 -0
- data/INTRO.md +63 -31
- data/Rakefile +3 -1
- data/bin/mtk +75 -32
- data/examples/drum_pattern.rb +2 -2
- data/examples/dynamic_pattern.rb +1 -1
- data/examples/helpers/output_selector.rb +71 -0
- data/examples/notation.rb +5 -1
- data/examples/tone_row_melody.rb +1 -1
- data/lib/mtk.rb +1 -0
- data/lib/mtk/core/duration.rb +18 -3
- data/lib/mtk/core/intensity.rb +5 -3
- data/lib/mtk/core/interval.rb +21 -14
- data/lib/mtk/core/pitch.rb +2 -0
- data/lib/mtk/core/pitch_class.rb +6 -3
- data/lib/mtk/events/event.rb +2 -1
- data/lib/mtk/events/note.rb +1 -1
- data/lib/mtk/events/parameter.rb +1 -0
- data/lib/mtk/events/rest.rb +85 -0
- data/lib/mtk/events/timeline.rb +6 -2
- data/lib/mtk/io/jsound_input.rb +9 -3
- data/lib/mtk/io/midi_file.rb +38 -2
- data/lib/mtk/io/midi_input.rb +1 -1
- data/lib/mtk/io/midi_output.rb +95 -4
- data/lib/mtk/io/unimidi_input.rb +7 -3
- data/lib/mtk/lang/durations.rb +31 -26
- data/lib/mtk/lang/intensities.rb +29 -30
- data/lib/mtk/lang/intervals.rb +108 -41
- data/lib/mtk/lang/mtk_grammar.citrus +14 -4
- data/lib/mtk/lang/parser.rb +10 -5
- data/lib/mtk/lang/pitch_classes.rb +45 -17
- data/lib/mtk/lang/pitches.rb +169 -32
- data/lib/mtk/lang/tutorial.rb +279 -0
- data/lib/mtk/lang/tutorial_lesson.rb +87 -0
- data/lib/mtk/sequencers/event_builder.rb +29 -8
- data/spec/mtk/core/duration_spec.rb +14 -1
- data/spec/mtk/core/intensity_spec.rb +1 -1
- data/spec/mtk/events/event_spec.rb +10 -16
- data/spec/mtk/events/note_spec.rb +3 -3
- data/spec/mtk/events/rest_spec.rb +184 -0
- data/spec/mtk/events/timeline_spec.rb +5 -1
- data/spec/mtk/io/midi_file_spec.rb +13 -2
- data/spec/mtk/io/midi_output_spec.rb +42 -9
- data/spec/mtk/lang/durations_spec.rb +5 -5
- data/spec/mtk/lang/intensities_spec.rb +5 -5
- data/spec/mtk/lang/intervals_spec.rb +139 -13
- data/spec/mtk/lang/parser_spec.rb +65 -25
- data/spec/mtk/lang/pitch_classes_spec.rb +0 -11
- data/spec/mtk/lang/pitches_spec.rb +0 -15
- data/spec/mtk/patterns/chain_spec.rb +7 -7
- data/spec/mtk/patterns/for_each_spec.rb +2 -2
- data/spec/mtk/sequencers/event_builder_spec.rb +49 -17
- metadata +12 -22
data/lib/mtk/io/midi_input.rb
CHANGED
data/lib/mtk/io/midi_output.rb
CHANGED
@@ -105,8 +105,12 @@ module MTK
|
|
105
105
|
pitch = event.midi_pitch
|
106
106
|
velocity = event.velocity
|
107
107
|
duration = event.duration.to_f
|
108
|
-
|
109
|
-
|
108
|
+
# Set a lower priority (via level:1) for note-ons, so legato notes at the same pitch don't
|
109
|
+
# prematurely chop off the next note, by ensuring all note-offs at the same timepoint occur first.
|
110
|
+
@scheduler.at(time, level: 1) { note_on(pitch,velocity,channel) }
|
111
|
+
@scheduler.at(time + duration) { note_on(pitch,0,channel) }
|
112
|
+
# TODO: use a proper note off message whenever we support off velocities
|
113
|
+
#@scheduler.at(time + duration) { note_off(pitch,velocity,channel) }
|
110
114
|
|
111
115
|
when :control
|
112
116
|
@scheduler.at(time) { control(event.number, event.midi_value, channel) }
|
@@ -127,7 +131,10 @@ module MTK
|
|
127
131
|
end
|
128
132
|
end
|
129
133
|
|
130
|
-
end_time = timeline.times.last
|
134
|
+
end_time = timeline.times.last
|
135
|
+
final_events = timeline[end_time]
|
136
|
+
max_length = final_events.inject(0) {|max,event| len = event.length; max > len ? max : len } || 0
|
137
|
+
end_time += max_length + trailing_buffer
|
131
138
|
@scheduler.at(end_time) { @scheduler.stop }
|
132
139
|
|
133
140
|
thread = @scheduler.run
|
@@ -192,4 +199,88 @@ unless $__RUNNING_RSPEC_TESTS__ # I can't get this working on Travis-CI, problem
|
|
192
199
|
else
|
193
200
|
require 'mtk/io/unimidi_output'
|
194
201
|
end
|
195
|
-
end
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
####################################################################################
|
207
|
+
# MONKEY PATCHING gamelan to ensure note-offs come before note-ons
|
208
|
+
# when they occur at the same scheduler time.
|
209
|
+
# This patch applies https://github.com/jvoorhis/gamelan/commit/20d93f4e5d86517bd5c6f9212a0dcdbf371d1ea1
|
210
|
+
# to provide the priority/level feature for the scheduler (see @scheduler.at() calls for notes above).
|
211
|
+
# This patch should not be necessary when gamelan gem > 0.3 is released
|
212
|
+
|
213
|
+
# @private
|
214
|
+
module Gamelan
|
215
|
+
|
216
|
+
DEFAULT_PRIORITY = 0
|
217
|
+
NOTEON_PRIORITY = 0
|
218
|
+
CC_PRIORITY = -1
|
219
|
+
PC_PRIORITY = -2
|
220
|
+
NOTEOFF_PRIORITY = -3
|
221
|
+
|
222
|
+
class Priority < Struct.new(:time, :level)
|
223
|
+
include Comparable
|
224
|
+
def <=>(prio)
|
225
|
+
self.to_a <=> prio.to_a
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
if defined?(JRUBY_VERSION)
|
230
|
+
|
231
|
+
class Queue
|
232
|
+
def initialize(scheduler)
|
233
|
+
@scheduler = scheduler
|
234
|
+
@queue = PriorityQueue.new(10000) { |a,b|
|
235
|
+
a.priority <=> b.priority
|
236
|
+
}
|
237
|
+
end
|
238
|
+
|
239
|
+
def ready?
|
240
|
+
if top = @queue.peek
|
241
|
+
top.delay < @scheduler.phase
|
242
|
+
else
|
243
|
+
false
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
else
|
249
|
+
|
250
|
+
class Queue
|
251
|
+
def push(task)
|
252
|
+
@queue.push(task, task.priority)
|
253
|
+
end
|
254
|
+
alias << push
|
255
|
+
|
256
|
+
def ready?
|
257
|
+
if top = @queue.min
|
258
|
+
top[1].time < @scheduler.phase
|
259
|
+
else
|
260
|
+
false
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
class Scheduler < Timer
|
268
|
+
def at(delay, options = {}, &task)
|
269
|
+
options = { :delay => delay, :scheduler => self }.merge(options)
|
270
|
+
@queue << Task.new(options, &task)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
class Task
|
275
|
+
attr_reader :level, :priority
|
276
|
+
|
277
|
+
def initialize(options, &block)
|
278
|
+
@scheduler = options[:scheduler]
|
279
|
+
@delay = options[:delay].to_f
|
280
|
+
@level = options[:level] || DEFAULT_PRIORITY
|
281
|
+
@priority = Priority.new(@delay, @level)
|
282
|
+
@proc = block
|
283
|
+
@args = options[:args] || []
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
data/lib/mtk/io/unimidi_input.rb
CHANGED
@@ -59,7 +59,7 @@ module MTK
|
|
59
59
|
|
60
60
|
bpm = options.fetch :bmp, 120
|
61
61
|
beats_per_second = bpm.to_f/60
|
62
|
-
timeline = Timeline.new
|
62
|
+
timeline = MTK::Events::Timeline.new
|
63
63
|
note_ons = {}
|
64
64
|
start = nil
|
65
65
|
|
@@ -69,9 +69,13 @@ module MTK
|
|
69
69
|
time /= beats_per_second
|
70
70
|
|
71
71
|
if message.is_a? MTK::Events::Event
|
72
|
-
timeline.add time,message
|
72
|
+
timeline.add time,message unless message.type == :unknown
|
73
73
|
else
|
74
|
-
|
74
|
+
message_type = message.type
|
75
|
+
message_type = :note_off if message_type == :note_on and message.velocity == 0
|
76
|
+
# TODO: this will need to be made more robust when we support off velocities
|
77
|
+
|
78
|
+
case message_type
|
75
79
|
when :note_on
|
76
80
|
pitch = message.pitch
|
77
81
|
note_ons[pitch] = [message,time]
|
data/lib/mtk/lang/durations.rb
CHANGED
@@ -5,51 +5,56 @@ module MTK
|
|
5
5
|
|
6
6
|
# Defines duration constants using abbreviations for standard rhythm values ('w' for whole note, 'h' for half note, etc).
|
7
7
|
#
|
8
|
-
#
|
8
|
+
# These can be thought of like constants, but in order to support the lower case names,
|
9
|
+
# it was necessary to define them as "pseudo constant" methods.
|
10
|
+
# Like constants, these methods are available either through the module (MTK::Lang::Durations::q) or
|
11
|
+
# via mixin (include MTK::Lang::Durations; q). They are listed under the "Instance Attribute Summary" of this page.
|
9
12
|
#
|
10
|
-
# These
|
11
|
-
#
|
12
|
-
# The methods are available either through the module (MTK::Core::Durations::e) or via mixin (include MTK::Core::Durations; q)
|
13
|
-
#
|
14
|
-
# These values assume the quarter note is one beat (1.0), so they work best with 4/4 and other */4 time signatures.
|
13
|
+
# These values assume the quarter note is one beat, so you may find they work best with 4/4 and other */4 time signatures
|
14
|
+
# (although it's certainly possible to use them with less common time signatures like 5/8).
|
15
15
|
#
|
16
16
|
# @note Including this module defines a bunch of single-character variables, which may shadow existing variable names.
|
17
17
|
# Just be mindful of what is defined in this module when including it.
|
18
18
|
#
|
19
|
-
# @see
|
19
|
+
# @see Core::Duration
|
20
|
+
# @see Events::Note
|
20
21
|
module Durations
|
21
22
|
extend MTK::Lang::PseudoConstants
|
22
23
|
|
23
|
-
#
|
24
|
-
|
24
|
+
# @private
|
25
|
+
# @!macro [attach] define_duration
|
26
|
+
# $3: $4 beat(s)
|
27
|
+
# @!attribute [r]
|
28
|
+
# @return [MTK::Core::Duration] duration of $4 beat(s)
|
29
|
+
def self.define_duration name, value, description, beats
|
30
|
+
define_constant name, value
|
31
|
+
end
|
32
|
+
|
33
|
+
|
25
34
|
# whole note
|
26
|
-
# @macro [attach] durations.
|
35
|
+
# @macro [attach] durations.define_duration
|
27
36
|
# @attribute [r]
|
28
|
-
# @return [$2]
|
29
|
-
|
37
|
+
# @return [$2] duration for $1
|
38
|
+
define_duration 'w', MTK::Core::Duration[4], 'whole note', 4
|
39
|
+
|
40
|
+
define_duration 'h', MTK::Core::Duration[2], 'half note', 2
|
30
41
|
|
31
|
-
|
32
|
-
define_constant 'h', MTK::Core::Duration[2]
|
42
|
+
define_duration 'q', MTK::Core::Duration[1], 'quarter note', 1
|
33
43
|
|
34
|
-
|
35
|
-
define_constant 'q', MTK::Core::Duration[1]
|
44
|
+
define_duration 'e', MTK::Core::Duration[Rational(1,2)], 'eighth note', '1/2'
|
36
45
|
|
37
|
-
|
38
|
-
define_constant 'i', MTK::Core::Duration[Rational(1,2)]
|
46
|
+
define_duration 's', MTK::Core::Duration[Rational(1,4)], 'sixteenth note', '1/4'
|
39
47
|
|
40
|
-
|
41
|
-
define_constant 's', MTK::Core::Duration[Rational(1,4)]
|
48
|
+
define_duration 'r', MTK::Core::Duration[Rational(1,8)], 'thirty-second note', '1/8'
|
42
49
|
|
43
|
-
|
44
|
-
define_constant 'r', MTK::Core::Duration[Rational(1,8)]
|
50
|
+
define_duration 'x', MTK::Core::Duration[Rational(1,16)], 'sixty-fourth note', '1/16'
|
45
51
|
|
46
|
-
# sixty-fourth note
|
47
|
-
define_constant 'x', MTK::Core::Duration[Rational(1,16)]
|
48
52
|
|
49
|
-
#
|
50
|
-
DURATIONS = [w, h, q,
|
53
|
+
# All "psuedo constants" defined in this module
|
54
|
+
DURATIONS = [w, h, q, e, s, r, x].freeze
|
51
55
|
|
52
56
|
# The names of all "psuedo constants" defined in this module
|
57
|
+
# @see MTK::Core::Duration::NAMES
|
53
58
|
DURATION_NAMES = MTK::Core::Duration::NAMES
|
54
59
|
|
55
60
|
end
|
data/lib/mtk/lang/intensities.rb
CHANGED
@@ -3,57 +3,56 @@ module MTK
|
|
3
3
|
|
4
4
|
# Defines intensity constants using standard dynamic symbols.
|
5
5
|
#
|
6
|
-
# These can be thought of like constants, but in order to
|
7
|
-
# it was necessary to
|
8
|
-
#
|
6
|
+
# These can be thought of like constants, but in order to support the lower case names,
|
7
|
+
# it was necessary to define them as "pseudo constant" methods.
|
8
|
+
# Like constants, these methods are available either through the module (MTK::Lang::Intensities::f) or
|
9
|
+
# via mixin (include MTK::Lang::Intensities; f). They are listed under the "Instance Attribute Summary" of this page.
|
9
10
|
#
|
10
11
|
# These values are intensities in the range 0.125 - 1.0 (in increments of 1/8), so they can be easily scaled (unlike MIDI velocities).
|
11
12
|
#
|
12
|
-
# It is also possible to retrieve values in increments of 1/24 by using the '+' and '-' suffix when looking
|
13
|
-
# up values via the {.[]} method.
|
14
|
-
#
|
15
13
|
# @note Including this module shadows Ruby's built-in p() method.
|
16
|
-
#
|
14
|
+
# If you include this module, you can access the built-in p() method via Kernel.p()
|
15
|
+
# Also be aware you might shadow existing variable names, like f.
|
17
16
|
#
|
18
|
-
# @see
|
17
|
+
# @see Core::Intensity
|
18
|
+
# @see Events::Note
|
19
19
|
module Intensities
|
20
20
|
extend MTK::Lang::PseudoConstants
|
21
21
|
|
22
|
-
#
|
22
|
+
# @private
|
23
|
+
# @!macro [attach] define_intensity
|
24
|
+
# $3: $4% intensity
|
25
|
+
# @!attribute [r]
|
26
|
+
# @return [MTK::Core::Interval] intensity of $4%
|
27
|
+
def self.define_intensity name, value, description, percentage_intensity
|
28
|
+
define_constant name, value
|
29
|
+
end
|
30
|
+
|
23
31
|
|
24
|
-
|
25
|
-
# @macro [attach] intensities.define_constant
|
26
|
-
# @attribute [r]
|
27
|
-
# @return [$2] intensity value for $1
|
28
|
-
define_constant 'ppp', MTK::Core::Intensity[0.125]
|
32
|
+
define_intensity 'ppp', MTK::Core::Intensity[0.125], 'pianississimo', '12.5'
|
29
33
|
|
30
|
-
|
31
|
-
define_constant 'pp', MTK::Core::Intensity[0.25]
|
34
|
+
define_intensity 'pp', MTK::Core::Intensity[0.25], 'pianissimo', 25
|
32
35
|
|
33
|
-
# piano
|
34
36
|
# @note Including this module shadows Ruby's built-in p() method.
|
35
37
|
# If you include this module, you can access the built-in p() method via Kernel.p()
|
36
|
-
|
38
|
+
define_intensity 'p', MTK::Core::Intensity[0.375], 'piano', '37.5'
|
39
|
+
|
40
|
+
define_intensity 'mp', MTK::Core::Intensity[0.5], 'mezzo-piano', 50
|
37
41
|
|
38
|
-
|
39
|
-
define_constant 'mp', MTK::Core::Intensity[0.5]
|
42
|
+
define_intensity 'mf', MTK::Core::Intensity[0.625], 'mezzo-forte', '62.5'
|
40
43
|
|
41
|
-
|
42
|
-
define_constant 'mf', MTK::Core::Intensity[0.625]
|
44
|
+
define_intensity 'f', MTK::Core::Intensity[0.75], 'forte', 75
|
43
45
|
|
44
|
-
|
45
|
-
define_constant 'o', MTK::Core::Intensity[0.75]
|
46
|
+
define_intensity 'ff', MTK::Core::Intensity[0.875], 'fortissimo', '87.5'
|
46
47
|
|
47
|
-
|
48
|
-
define_constant 'ff', MTK::Core::Intensity[0.875]
|
48
|
+
define_intensity 'fff', MTK::Core::Intensity[1.0], 'fortississimo', 100
|
49
49
|
|
50
|
-
# fortississimo
|
51
|
-
define_constant 'fff', MTK::Core::Intensity[1.0]
|
52
50
|
|
53
|
-
#
|
54
|
-
INTENSITIES = [ppp, pp, p, mp, mf,
|
51
|
+
# All "psuedo constants" defined in this module
|
52
|
+
INTENSITIES = [ppp, pp, p, mp, mf, f, ff, fff].freeze
|
55
53
|
|
56
54
|
# The names of all "psuedo constants" defined in this module
|
55
|
+
# @see MTK::Core::Intensity::NAMES
|
57
56
|
INTENSITY_NAMES = MTK::Core::Intensity::NAMES
|
58
57
|
|
59
58
|
end
|
data/lib/mtk/lang/intervals.rb
CHANGED
@@ -1,72 +1,139 @@
|
|
1
1
|
module MTK
|
2
2
|
module Lang
|
3
3
|
|
4
|
-
# Defines a constant for
|
4
|
+
# Defines a constant for {Core::Interval}s up to an octave using diatonic naming conventions
|
5
5
|
#
|
6
6
|
# Naming conventions
|
7
7
|
# P#: perfect interval
|
8
8
|
# M#: major interval
|
9
9
|
# m#: minor interval
|
10
|
-
# TT: tritone
|
10
|
+
# TT: tritone
|
11
|
+
# a#: augmented interval
|
12
|
+
# d#: diminished interval
|
11
13
|
#
|
12
|
-
# These can be thought of like constants, but in order to
|
13
|
-
# it was necessary to
|
14
|
-
#
|
14
|
+
# These can be thought of like constants, but in order to support the lower case names,
|
15
|
+
# it was necessary to define them as "pseudo constant" methods.
|
16
|
+
# Like constants, these methods are available either through the module (MTK::Lang::Intervals::m2) or
|
17
|
+
# via mixin (include MTK::Lang::Intervals; m2). They are listed under the "Instance Attribute Summary" of this page.
|
18
|
+
#
|
19
|
+
# @see Core::Interval
|
20
|
+
# @see http://en.wikipedia.org/wiki/Interval_(music)#Main_intervals
|
15
21
|
module Intervals
|
16
22
|
extend MTK::Lang::PseudoConstants
|
17
23
|
|
18
|
-
#
|
24
|
+
# @private
|
25
|
+
# @!macro [attach] define_interval
|
26
|
+
# $3: $4 semitones
|
27
|
+
# @!attribute [r]
|
28
|
+
# @return [MTK::Core::Interval] interval of $4 semitones
|
29
|
+
def self.define_interval name, value, description, semitones
|
30
|
+
define_constant name, value
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
# @see #d2
|
35
|
+
define_interval 'P1', MTK::Core::Interval[0], 'perfect unison', 0
|
36
|
+
|
37
|
+
# @see #P1
|
38
|
+
define_interval 'd2', MTK::Core::Interval[0], 'diminished second', 0
|
39
|
+
|
40
|
+
|
41
|
+
# @see #a1
|
42
|
+
define_interval 'm2', MTK::Core::Interval[1], 'minor second', 1
|
43
|
+
|
44
|
+
# @see #m2
|
45
|
+
define_interval 'a1', MTK::Core::Interval[1], 'augmented unison', 1
|
46
|
+
|
47
|
+
|
48
|
+
# @see #d3
|
49
|
+
define_interval 'M2', MTK::Core::Interval[2], 'major second', 2
|
50
|
+
|
51
|
+
# @see #M2
|
52
|
+
define_interval 'd3', MTK::Core::Interval[2], 'diminished third', 2
|
53
|
+
|
54
|
+
|
55
|
+
# @see #a2
|
56
|
+
define_interval 'm3', MTK::Core::Interval[3], 'minor third', 3
|
57
|
+
|
58
|
+
# @see #m3
|
59
|
+
define_interval 'a2', MTK::Core::Interval[3], 'augmented second', 3
|
60
|
+
|
61
|
+
|
62
|
+
# @see #d4
|
63
|
+
define_interval 'M3', MTK::Core::Interval[4], 'major third', 4
|
64
|
+
|
65
|
+
# @see #M3
|
66
|
+
define_interval 'd4', MTK::Core::Interval[4], 'diminished fourth', 4
|
67
|
+
|
68
|
+
|
69
|
+
# @see #a3
|
70
|
+
define_interval 'P4', MTK::Core::Interval[5], 'perfect fourth', 5
|
71
|
+
|
72
|
+
# @see #P4
|
73
|
+
define_interval 'a3', MTK::Core::Interval[5], 'augmented third', 5
|
74
|
+
|
75
|
+
|
76
|
+
# @see #a4
|
77
|
+
# @see #d5
|
78
|
+
define_interval 'TT', MTK::Core::Interval[6], 'tritone', 6
|
79
|
+
|
80
|
+
# @see #TT
|
81
|
+
# @see #d5
|
82
|
+
define_interval 'a4', MTK::Core::Interval[6], 'augmented fourth', 6
|
83
|
+
|
84
|
+
# @see #TT
|
85
|
+
# @see #a4
|
86
|
+
define_interval 'd5', MTK::Core::Interval[6], 'diminished fifth', 6
|
87
|
+
|
88
|
+
|
89
|
+
# @see #d6
|
90
|
+
define_interval 'P5', MTK::Core::Interval[7], 'perfect fifth', 7
|
91
|
+
|
92
|
+
# @see #P5
|
93
|
+
define_interval 'd6', MTK::Core::Interval[7], 'diminished sixth', 7
|
94
|
+
|
95
|
+
|
96
|
+
# @see #a5
|
97
|
+
define_interval 'm6', MTK::Core::Interval[8], 'minor sixth', 8
|
98
|
+
|
99
|
+
# @see #m6
|
100
|
+
define_interval 'a5', MTK::Core::Interval[8], 'augmented fifth', 8
|
19
101
|
|
20
|
-
# perfect unison
|
21
|
-
# @macro [attach] interval.define_constant
|
22
|
-
# @attribute [r]
|
23
|
-
# @return [$2] number of semitones in the interval $1
|
24
|
-
define_constant 'P1', MTK::Core::Interval[0]
|
25
102
|
|
26
|
-
#
|
27
|
-
|
28
|
-
# @attribute [r]
|
29
|
-
# @return [$2] number of semitones in the interval $1
|
30
|
-
define_constant 'm2', MTK::Core::Interval[1]
|
103
|
+
# @see #d7
|
104
|
+
define_interval 'M6', MTK::Core::Interval[9], 'major sixth', 9
|
31
105
|
|
32
|
-
#
|
33
|
-
|
106
|
+
# @see #M6
|
107
|
+
define_interval 'd7', MTK::Core::Interval[9], 'diminished seventh', 9
|
34
108
|
|
35
|
-
# minor third
|
36
|
-
define_constant 'm3', MTK::Core::Interval[3]
|
37
109
|
|
38
|
-
#
|
39
|
-
|
110
|
+
# @see #a6
|
111
|
+
define_interval 'm7', MTK::Core::Interval[10], 'minor seventh', 10
|
40
112
|
|
41
|
-
#
|
42
|
-
|
113
|
+
# @see #m7
|
114
|
+
define_interval 'a6', MTK::Core::Interval[10], 'augmented sixth', 10
|
43
115
|
|
44
|
-
# tritone (AKA augmented fourth or diminished fifth)
|
45
|
-
define_constant 'TT', MTK::Core::Interval[6]
|
46
116
|
|
47
|
-
#
|
48
|
-
|
117
|
+
# @see #d8
|
118
|
+
define_interval 'M7', MTK::Core::Interval[11], 'major seventh', 11
|
49
119
|
|
50
|
-
#
|
51
|
-
|
120
|
+
# @see #M7
|
121
|
+
define_interval 'd8', MTK::Core::Interval[11], 'diminished octave', 11
|
52
122
|
|
53
|
-
# major sixth
|
54
|
-
define_constant 'M6', MTK::Core::Interval[9]
|
55
123
|
|
56
|
-
#
|
57
|
-
|
124
|
+
# @see #a7
|
125
|
+
define_interval 'P8', MTK::Core::Interval[12], 'perfect octave', 12
|
58
126
|
|
59
|
-
#
|
60
|
-
|
127
|
+
# @see #P8
|
128
|
+
define_interval 'a7', MTK::Core::Interval[12], 'augmented seventh', 12
|
61
129
|
|
62
|
-
# pefect octave
|
63
|
-
define_constant 'P8', MTK::Core::Interval[12]
|
64
130
|
|
65
|
-
#
|
66
|
-
INTERVALS = [P1, m2, M2, m3, M3, P4, TT, P5, m6, M6, m7, M7, P8].freeze
|
131
|
+
# All "psuedo constants" defined in this module
|
132
|
+
INTERVALS = [P1, d2, m2, a1, M2, d3, m3, a2, M3, d4, P4, a3, TT, a4, d5, P5, d6, m6, a5, M6, d7, m7, a6, M7, d8, P8, a7].freeze
|
67
133
|
|
68
134
|
# The names of all "psuedo constants" defined in this module
|
69
|
-
|
135
|
+
# @see MTK::Core::Interval::NAMES_BY_VALUE
|
136
|
+
INTERVAL_NAMES = MTK::Core::Interval::ALL_NAMES
|
70
137
|
|
71
138
|
end
|
72
139
|
end
|