midilib 2.0.2 → 3.0.1
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 +7 -0
- data/ChangeLog +2 -1
- data/Credits +44 -2
- data/README.rdoc +42 -33
- data/Rakefile +36 -53
- data/TODO.rdoc +13 -2
- data/examples/from_scratch.rb +4 -6
- data/examples/measures_mbt.rb +11 -11
- data/examples/print_program_changes.rb +11 -11
- data/examples/reader2text.rb +191 -190
- data/examples/seq2text.rb +18 -18
- data/examples/split.rb +21 -20
- data/examples/strings.rb +15 -15
- data/examples/transpose.rb +41 -42
- data/install.rb +53 -34
- data/lib/midilib/consts.rb +406 -408
- data/lib/midilib/event.rb +335 -306
- data/lib/midilib/info.rb +5 -7
- data/lib/midilib/io/midifile.rb +424 -452
- data/lib/midilib/io/seqreader.rb +187 -192
- data/lib/midilib/io/seqwriter.rb +151 -147
- data/lib/midilib/measure.rb +78 -80
- data/lib/midilib/mergesort.rb +39 -0
- data/lib/midilib/sequence.rb +99 -86
- data/lib/midilib/track.rb +71 -118
- data/lib/midilib/utils.rb +17 -20
- data/lib/midilib.rb +5 -5
- data/test/event_equality.rb +50 -52
- data/test/test_event.rb +120 -124
- data/test/test_io.rb +107 -40
- data/test/test_mergesort.rb +37 -0
- data/test/test_midifile.rb +6 -19
- data/test/test_sequence.rb +64 -52
- data/test/test_track.rb +126 -155
- data/test/test_varlen.rb +23 -27
- metadata +20 -22
data/lib/midilib/consts.rb
CHANGED
@@ -1,426 +1,424 @@
|
|
1
1
|
# MIDI constants.
|
2
2
|
module MIDI
|
3
|
+
# Number of MIDI channels
|
4
|
+
MIDI_CHANNELS = 16
|
5
|
+
# Number of note per MIDI channel
|
6
|
+
NOTES_PER_CHANNEL = 128
|
3
7
|
|
4
|
-
# Number of MIDI channels
|
5
|
-
MIDI_CHANNELS = 16
|
6
|
-
# Number of note per MIDI channel
|
7
|
-
NOTES_PER_CHANNEL = 128
|
8
|
-
|
9
|
-
#--
|
10
|
-
# Standard MIDI File meta event defs.
|
11
|
-
#++
|
12
|
-
META_EVENT = 0xff
|
13
|
-
META_SEQ_NUM = 0x00
|
14
|
-
META_TEXT = 0x01
|
15
|
-
META_COPYRIGHT = 0x02
|
16
|
-
META_SEQ_NAME = 0x03
|
17
|
-
META_INSTRUMENT = 0x04
|
18
|
-
META_LYRIC = 0x05
|
19
|
-
META_MARKER = 0x06
|
20
|
-
META_CUE = 0x07
|
21
|
-
META_MIDI_CHAN_PREFIX = 0x20
|
22
|
-
META_TRACK_END = 0x2f
|
23
|
-
META_SET_TEMPO = 0x51
|
24
|
-
META_SMPTE = 0x54
|
25
|
-
META_TIME_SIG = 0x58
|
26
|
-
META_KEY_SIG = 0x59
|
27
|
-
META_SEQ_SPECIF = 0x7f
|
28
|
-
|
29
|
-
#--
|
30
|
-
# Channel messages
|
31
|
-
#++
|
32
|
-
# Note, val
|
33
|
-
NOTE_OFF = 0x80
|
34
|
-
# Note, val
|
35
|
-
NOTE_ON = 0x90
|
36
|
-
# Note, val
|
37
|
-
POLY_PRESSURE = 0xA0
|
38
|
-
# Controller #, val
|
39
|
-
CONTROLLER = 0xB0
|
40
|
-
# Program number
|
41
|
-
PROGRAM_CHANGE = 0xC0
|
42
|
-
# Channel pressure
|
43
|
-
CHANNEL_PRESSURE = 0xD0
|
44
|
-
# LSB, MSB
|
45
|
-
PITCH_BEND = 0xE0
|
46
|
-
|
47
|
-
#--
|
48
|
-
# System common messages
|
49
|
-
#++
|
50
|
-
# System exclusive start
|
51
|
-
SYSEX = 0xF0
|
52
|
-
# Beats from top: LSB/MSB 6 ticks = 1 beat
|
53
|
-
SONG_POINTER = 0xF2
|
54
|
-
# Val = number of song
|
55
|
-
SONG_SELECT = 0xF3
|
56
|
-
# Tune request
|
57
|
-
TUNE_REQUEST = 0xF6
|
58
|
-
# End of system exclusive
|
59
|
-
EOX = 0xF7
|
60
|
-
|
61
|
-
#--
|
62
|
-
# System realtime messages
|
63
|
-
#++
|
64
|
-
# MIDI clock (24 per quarter note)
|
65
|
-
CLOCK = 0xF8
|
66
|
-
# Sequence start
|
67
|
-
START = 0xFA
|
68
|
-
# Sequence continue
|
69
|
-
CONTINUE = 0xFB
|
70
|
-
# Sequence stop
|
71
|
-
STOP = 0xFC
|
72
|
-
# Active sensing (sent every 300 ms when nothing else being sent)
|
73
|
-
ACTIVE_SENSE = 0xFE
|
74
|
-
# System reset
|
75
|
-
SYSTEM_RESET = 0xFF
|
76
|
-
|
77
|
-
# Controller numbers
|
78
|
-
# = 0 - 31 = continuous, LSB
|
79
|
-
# = 32 - 63 = continuous, MSB
|
80
|
-
# = 64 - 97 = switches
|
81
|
-
CC_MOD_WHEEL = 1
|
82
|
-
CC_BREATH_CONTROLLER = 2
|
83
|
-
CC_FOOT_CONTROLLER = 4
|
84
|
-
CC_PORTAMENTO_TIME = 5
|
85
|
-
CC_DATA_ENTRY_MSB = 6
|
86
|
-
CC_VOLUME = 7
|
87
|
-
CC_BALANCE = 8
|
88
|
-
CC_PAN = 10
|
89
|
-
CC_EXPRESSION_CONTROLLER = 11
|
90
|
-
CC_GEN_PURPOSE_1 = 16
|
91
|
-
CC_GEN_PURPOSE_2 = 17
|
92
|
-
CC_GEN_PURPOSE_3 = 18
|
93
|
-
CC_GEN_PURPOSE_4 = 19
|
94
|
-
|
95
|
-
# [32 - 63] are LSB for [0 - 31]
|
96
|
-
CC_DATA_ENTRY_LSB = 38
|
97
|
-
|
98
|
-
#--
|
99
|
-
# Momentaries:
|
100
|
-
#++
|
101
|
-
CC_SUSTAIN = 64
|
102
|
-
CC_PORTAMENTO = 65
|
103
|
-
CC_SUSTENUTO = 66
|
104
|
-
CC_SOFT_PEDAL = 67
|
105
|
-
CC_HOLD_2 = 69
|
106
|
-
CC_GEN_PURPOSE_5 = 50
|
107
|
-
CC_GEN_PURPOSE_6 = 51
|
108
|
-
CC_GEN_PURPOSE_7 = 52
|
109
|
-
CC_GEN_PURPOSE_8 = 53
|
110
|
-
CC_TREMELO_DEPTH = 92
|
111
|
-
CC_CHORUS_DEPTH = 93
|
112
|
-
CC_DETUNE_DEPTH = 94
|
113
|
-
CC_PHASER_DEPTH = 95
|
114
|
-
CC_DATA_INCREMENT = 96
|
115
|
-
CC_DATA_DECREMENT = 97
|
116
|
-
CC_NREG_PARAM_LSB = 98
|
117
|
-
CC_NREG_PARAM_MSB = 99
|
118
|
-
CC_REG_PARAM_LSB = 100
|
119
|
-
CC_REG_PARAM_MSB = 101
|
120
|
-
|
121
|
-
#--
|
122
|
-
# Channel mode message values
|
123
|
-
#++
|
124
|
-
# Val 0 == off, 0x7f == on
|
125
|
-
CM_LOCAL_CONTROL = 0x7A
|
126
|
-
CM_ALL_NOTES_OFF = 0x7B # Val must be 0
|
127
|
-
CM_OMNI_MODE_OFF = 0x7C # Val must be 0
|
128
|
-
CM_OMNI_MODE_ON = 0x7D # Val must be 0
|
129
|
-
CM_MONO_MODE_ON = 0x7E # Val = # chans
|
130
|
-
CM_POLY_MODE_ON = 0x7F # Val must be 0
|
131
|
-
|
132
|
-
# Controller names
|
133
|
-
CONTROLLER_NAMES = [
|
134
|
-
"0",
|
135
|
-
"Modulation",
|
136
|
-
"Breath Control",
|
137
|
-
"3",
|
138
|
-
"Foot Controller",
|
139
|
-
"Portamento Time",
|
140
|
-
"Data Entry",
|
141
|
-
"Volume",
|
142
|
-
"Balance",
|
143
|
-
"9",
|
144
|
-
"Pan",
|
145
|
-
"Expression Control",
|
146
|
-
"12", "13", "14", "15",
|
147
|
-
"General Controller 1",
|
148
|
-
"General Controller 2",
|
149
|
-
"General Controller 3",
|
150
|
-
"General Controller 4",
|
151
|
-
"20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
|
152
|
-
"30", "31",
|
153
|
-
"32", "33", "34", "35", "36", "37", "38", "39", "40", "41",
|
154
|
-
"42", "43", "44", "45", "46", "47", "48", "49", "50", "51",
|
155
|
-
"52", "53", "54", "55", "56", "57", "58", "59", "60", "61",
|
156
|
-
"62", "63",
|
157
|
-
"Sustain Pedal",
|
158
|
-
"Portamento",
|
159
|
-
"Sostenuto",
|
160
|
-
"Soft Pedal",
|
161
|
-
"68",
|
162
|
-
"Hold 2",
|
163
|
-
"70", "71", "72", "73", "74", "75", "76", "77", "78", "79",
|
164
|
-
"General Controller 5",
|
165
|
-
"Tempo Change",
|
166
|
-
"General Controller 7",
|
167
|
-
"General Controller 8",
|
168
|
-
"84", "85", "86", "87", "88", "89", "90",
|
169
|
-
"External Effects Depth",
|
170
|
-
"Tremolo Depth",
|
171
|
-
"Chorus Depth",
|
172
|
-
"Detune (Celeste) Depth",
|
173
|
-
"Phaser Depth",
|
174
|
-
"Data Increment",
|
175
|
-
"Data Decrement",
|
176
|
-
"Non-Registered Param LSB",
|
177
|
-
"Non-Registered Param MSB",
|
178
|
-
"Registered Param LSB",
|
179
|
-
"Registered Param MSB",
|
180
|
-
"102", "103", "104", "105", "106", "107", "108", "109",
|
181
|
-
"110", "111", "112", "113", "114", "115", "116", "117",
|
182
|
-
"118", "119", "120",
|
183
|
-
"Reset All Controllers",
|
184
|
-
"Local Control",
|
185
|
-
"All Notes Off",
|
186
|
-
"Omni Mode Off",
|
187
|
-
"Omni Mode On",
|
188
|
-
"Mono Mode On",
|
189
|
-
"Poly Mode On"
|
190
|
-
]
|
191
|
-
|
192
|
-
# General MIDI patch names
|
193
|
-
GM_PATCH_NAMES = [
|
194
|
-
#--
|
195
|
-
# Pianos
|
196
|
-
#++
|
197
|
-
"Acoustic Grand Piano",
|
198
|
-
"Bright Acoustic Piano",
|
199
|
-
"Electric Grand Piano",
|
200
|
-
"Honky-tonk Piano",
|
201
|
-
"Electric Piano 1",
|
202
|
-
"Electric Piano 2",
|
203
|
-
"Harpsichord",
|
204
|
-
"Clavichord",
|
205
|
-
#--
|
206
|
-
# Tuned Idiophones
|
207
|
-
#++
|
208
|
-
"Celesta",
|
209
|
-
"Glockenspiel",
|
210
|
-
"Music Box",
|
211
|
-
"Vibraphone",
|
212
|
-
"Marimba",
|
213
|
-
"Xylophone",
|
214
|
-
"Tubular Bells",
|
215
|
-
"Dulcimer",
|
216
|
-
#--
|
217
|
-
# Organs
|
218
|
-
#++
|
219
|
-
"Drawbar Organ",
|
220
|
-
"Percussive Organ",
|
221
|
-
"Rock Organ",
|
222
|
-
"Church Organ",
|
223
|
-
"Reed Organ",
|
224
|
-
"Accordion",
|
225
|
-
"Harmonica",
|
226
|
-
"Tango Accordion",
|
227
|
-
#--
|
228
|
-
# Guitars
|
229
|
-
#++
|
230
|
-
"Acoustic Guitar (nylon)",
|
231
|
-
"Acoustic Guitar (steel)",
|
232
|
-
"Electric Guitar (jazz)",
|
233
|
-
"Electric Guitar (clean)",
|
234
|
-
"Electric Guitar (muted)",
|
235
|
-
"Overdriven Guitar",
|
236
|
-
"Distortion Guitar",
|
237
|
-
"Guitar harmonics",
|
238
|
-
#--
|
239
|
-
# Basses
|
240
|
-
#++
|
241
|
-
"Acoustic Bass",
|
242
|
-
"Electric Bass (finger)",
|
243
|
-
"Electric Bass (pick)",
|
244
|
-
"Fretless Bass",
|
245
|
-
"Slap Bass 1",
|
246
|
-
"Slap Bass 2",
|
247
|
-
"Synth Bass 1",
|
248
|
-
"Synth Bass 2",
|
249
|
-
#--
|
250
|
-
# Strings
|
251
|
-
#++
|
252
|
-
"Violin",
|
253
|
-
"Viola",
|
254
|
-
"Cello",
|
255
|
-
"Contrabass",
|
256
|
-
"Tremolo Strings",
|
257
|
-
"Pizzicato Strings",
|
258
|
-
"Orchestral Harp",
|
259
|
-
"Timpani",
|
260
|
-
#--
|
261
|
-
# Ensemble strings and voices
|
262
|
-
#++
|
263
|
-
"String Ensemble 1",
|
264
|
-
"String Ensemble 2",
|
265
|
-
"SynthStrings 1",
|
266
|
-
"SynthStrings 2",
|
267
|
-
"Choir Aahs",
|
268
|
-
"Voice Oohs",
|
269
|
-
"Synth Voice",
|
270
|
-
"Orchestra Hit",
|
271
8
|
#--
|
272
|
-
#
|
9
|
+
# Standard MIDI File meta event defs.
|
273
10
|
#++
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
"Bassoon",
|
292
|
-
"Clarinet",
|
293
|
-
#--
|
294
|
-
# Pipes
|
295
|
-
#++
|
296
|
-
"Piccolo",
|
297
|
-
"Flute",
|
298
|
-
"Recorder",
|
299
|
-
"Pan Flute",
|
300
|
-
"Blown Bottle",
|
301
|
-
"Shakuhachi",
|
302
|
-
"Whistle",
|
303
|
-
"Ocarina",
|
304
|
-
#--
|
305
|
-
# Synth Leads
|
306
|
-
#++
|
307
|
-
"Lead 1 (square)",
|
308
|
-
"Lead 2 (sawtooth)",
|
309
|
-
"Lead 3 (calliope)",
|
310
|
-
"Lead 4 (chiff)",
|
311
|
-
"Lead 5 (charang)",
|
312
|
-
"Lead 6 (voice)",
|
313
|
-
"Lead 7 (fifths)",
|
314
|
-
"Lead 8 (bass + lead)",
|
11
|
+
META_EVENT = 0xff
|
12
|
+
META_SEQ_NUM = 0x00
|
13
|
+
META_TEXT = 0x01
|
14
|
+
META_COPYRIGHT = 0x02
|
15
|
+
META_SEQ_NAME = 0x03
|
16
|
+
META_INSTRUMENT = 0x04
|
17
|
+
META_LYRIC = 0x05
|
18
|
+
META_MARKER = 0x06
|
19
|
+
META_CUE = 0x07
|
20
|
+
META_MIDI_CHAN_PREFIX = 0x20
|
21
|
+
META_TRACK_END = 0x2f
|
22
|
+
META_SET_TEMPO = 0x51
|
23
|
+
META_SMPTE = 0x54
|
24
|
+
META_TIME_SIG = 0x58
|
25
|
+
META_KEY_SIG = 0x59
|
26
|
+
META_SEQ_SPECIF = 0x7f
|
27
|
+
|
315
28
|
#--
|
316
|
-
#
|
29
|
+
# Channel messages
|
317
30
|
#++
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
31
|
+
# Note, val
|
32
|
+
NOTE_OFF = 0x80
|
33
|
+
# Note, val
|
34
|
+
NOTE_ON = 0x90
|
35
|
+
# Note, val
|
36
|
+
POLY_PRESSURE = 0xA0
|
37
|
+
# Controller #, val
|
38
|
+
CONTROLLER = 0xB0
|
39
|
+
# Program number
|
40
|
+
PROGRAM_CHANGE = 0xC0
|
41
|
+
# Channel pressure
|
42
|
+
CHANNEL_PRESSURE = 0xD0
|
43
|
+
# LSB, MSB
|
44
|
+
PITCH_BEND = 0xE0
|
45
|
+
|
326
46
|
#--
|
327
|
-
#
|
47
|
+
# System common messages
|
328
48
|
#++
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
49
|
+
# System exclusive start
|
50
|
+
SYSEX = 0xF0
|
51
|
+
# Beats from top: LSB/MSB 6 ticks = 1 beat
|
52
|
+
SONG_POINTER = 0xF2
|
53
|
+
# Val = number of song
|
54
|
+
SONG_SELECT = 0xF3
|
55
|
+
# Tune request
|
56
|
+
TUNE_REQUEST = 0xF6
|
57
|
+
# End of system exclusive
|
58
|
+
EOX = 0xF7
|
59
|
+
|
337
60
|
#--
|
338
|
-
#
|
61
|
+
# System realtime messages
|
339
62
|
#++
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
63
|
+
# MIDI clock (24 per quarter note)
|
64
|
+
CLOCK = 0xF8
|
65
|
+
# Sequence start
|
66
|
+
START = 0xFA
|
67
|
+
# Sequence continue
|
68
|
+
CONTINUE = 0xFB
|
69
|
+
# Sequence stop
|
70
|
+
STOP = 0xFC
|
71
|
+
# Active sensing (sent every 300 ms when nothing else being sent)
|
72
|
+
ACTIVE_SENSE = 0xFE
|
73
|
+
# System reset
|
74
|
+
SYSTEM_RESET = 0xFF
|
75
|
+
|
76
|
+
# Controller numbers
|
77
|
+
# = 0 - 31 = continuous, MSB
|
78
|
+
# = 32 - 63 = continuous, LSB
|
79
|
+
# = 64 - 97 = switches
|
80
|
+
CC_MOD_WHEEL = 1
|
81
|
+
CC_BREATH_CONTROLLER = 2
|
82
|
+
CC_FOOT_CONTROLLER = 4
|
83
|
+
CC_PORTAMENTO_TIME = 5
|
84
|
+
CC_DATA_ENTRY_MSB = 6
|
85
|
+
CC_VOLUME = 7
|
86
|
+
CC_BALANCE = 8
|
87
|
+
CC_PAN = 10
|
88
|
+
CC_EXPRESSION_CONTROLLER = 11
|
89
|
+
CC_GEN_PURPOSE_1 = 16
|
90
|
+
CC_GEN_PURPOSE_2 = 17
|
91
|
+
CC_GEN_PURPOSE_3 = 18
|
92
|
+
CC_GEN_PURPOSE_4 = 19
|
93
|
+
|
94
|
+
# [32 - 63] are LSB for [0 - 31]
|
95
|
+
CC_DATA_ENTRY_LSB = 38
|
96
|
+
|
348
97
|
#--
|
349
|
-
#
|
98
|
+
# Momentaries:
|
350
99
|
#++
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
100
|
+
CC_SUSTAIN = 64
|
101
|
+
CC_PORTAMENTO = 65
|
102
|
+
CC_SUSTENUTO = 66
|
103
|
+
CC_SOFT_PEDAL = 67
|
104
|
+
CC_HOLD_2 = 69
|
105
|
+
CC_GEN_PURPOSE_5 = 80
|
106
|
+
CC_GEN_PURPOSE_6 = 81
|
107
|
+
CC_GEN_PURPOSE_7 = 82
|
108
|
+
CC_GEN_PURPOSE_8 = 83
|
109
|
+
CC_TREMELO_DEPTH = 92
|
110
|
+
CC_CHORUS_DEPTH = 93
|
111
|
+
CC_DETUNE_DEPTH = 94
|
112
|
+
CC_PHASER_DEPTH = 95
|
113
|
+
CC_DATA_INCREMENT = 96
|
114
|
+
CC_DATA_DECREMENT = 97
|
115
|
+
CC_NREG_PARAM_LSB = 98
|
116
|
+
CC_NREG_PARAM_MSB = 99
|
117
|
+
CC_REG_PARAM_LSB = 100
|
118
|
+
CC_REG_PARAM_MSB = 101
|
119
|
+
|
359
120
|
#--
|
360
|
-
#
|
121
|
+
# Channel mode message values
|
361
122
|
#++
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
123
|
+
# Val 0 == off, 0x7f == on
|
124
|
+
CM_LOCAL_CONTROL = 0x7A
|
125
|
+
CM_ALL_NOTES_OFF = 0x7B # Val must be 0
|
126
|
+
CM_OMNI_MODE_OFF = 0x7C # Val must be 0
|
127
|
+
CM_OMNI_MODE_ON = 0x7D # Val must be 0
|
128
|
+
CM_MONO_MODE_ON = 0x7E # Val = # chans
|
129
|
+
CM_POLY_MODE_ON = 0x7F # Val must be 0
|
130
|
+
|
131
|
+
# Controller names
|
132
|
+
CONTROLLER_NAMES = [
|
133
|
+
'0',
|
134
|
+
'Modulation',
|
135
|
+
'Breath Control',
|
136
|
+
'3',
|
137
|
+
'Foot Controller',
|
138
|
+
'Portamento Time',
|
139
|
+
'Data Entry',
|
140
|
+
'Volume',
|
141
|
+
'Balance',
|
142
|
+
'9',
|
143
|
+
'Pan',
|
144
|
+
'Expression Control',
|
145
|
+
'12', '13', '14', '15',
|
146
|
+
'General Controller 1',
|
147
|
+
'General Controller 2',
|
148
|
+
'General Controller 3',
|
149
|
+
'General Controller 4',
|
150
|
+
'20', '21', '22', '23', '24', '25', '26', '27', '28', '29',
|
151
|
+
'30', '31',
|
152
|
+
'32', '33', '34', '35', '36', '37', '38', '39', '40', '41',
|
153
|
+
'42', '43', '44', '45', '46', '47', '48', '49', '50', '51',
|
154
|
+
'52', '53', '54', '55', '56', '57', '58', '59', '60', '61',
|
155
|
+
'62', '63',
|
156
|
+
'Sustain Pedal',
|
157
|
+
'Portamento',
|
158
|
+
'Sostenuto',
|
159
|
+
'Soft Pedal',
|
160
|
+
'68',
|
161
|
+
'Hold 2',
|
162
|
+
'70', '71', '72', '73', '74', '75', '76', '77', '78', '79',
|
163
|
+
'General Controller 5',
|
164
|
+
'Tempo Change',
|
165
|
+
'General Controller 7',
|
166
|
+
'General Controller 8',
|
167
|
+
'84', '85', '86', '87', '88', '89', '90',
|
168
|
+
'External Effects Depth',
|
169
|
+
'Tremolo Depth',
|
170
|
+
'Chorus Depth',
|
171
|
+
'Detune (Celeste) Depth',
|
172
|
+
'Phaser Depth',
|
173
|
+
'Data Increment',
|
174
|
+
'Data Decrement',
|
175
|
+
'Non-Registered Param LSB',
|
176
|
+
'Non-Registered Param MSB',
|
177
|
+
'Registered Param LSB',
|
178
|
+
'Registered Param MSB',
|
179
|
+
'102', '103', '104', '105', '106', '107', '108', '109',
|
180
|
+
'110', '111', '112', '113', '114', '115', '116', '117',
|
181
|
+
'118', '119', '120',
|
182
|
+
'Reset All Controllers',
|
183
|
+
'Local Control',
|
184
|
+
'All Notes Off',
|
185
|
+
'Omni Mode Off',
|
186
|
+
'Omni Mode On',
|
187
|
+
'Mono Mode On',
|
188
|
+
'Poly Mode On'
|
189
|
+
]
|
371
190
|
|
372
|
-
#
|
373
|
-
|
374
|
-
|
375
|
-
#
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
191
|
+
# General MIDI patch names
|
192
|
+
GM_PATCH_NAMES = [
|
193
|
+
#--
|
194
|
+
# Pianos
|
195
|
+
#++
|
196
|
+
'Acoustic Grand Piano',
|
197
|
+
'Bright Acoustic Piano',
|
198
|
+
'Electric Grand Piano',
|
199
|
+
'Honky-tonk Piano',
|
200
|
+
'Electric Piano 1',
|
201
|
+
'Electric Piano 2',
|
202
|
+
'Harpsichord',
|
203
|
+
'Clavichord',
|
204
|
+
#--
|
205
|
+
# Tuned Idiophones
|
206
|
+
#++
|
207
|
+
'Celesta',
|
208
|
+
'Glockenspiel',
|
209
|
+
'Music Box',
|
210
|
+
'Vibraphone',
|
211
|
+
'Marimba',
|
212
|
+
'Xylophone',
|
213
|
+
'Tubular Bells',
|
214
|
+
'Dulcimer',
|
215
|
+
#--
|
216
|
+
# Organs
|
217
|
+
#++
|
218
|
+
'Drawbar Organ',
|
219
|
+
'Percussive Organ',
|
220
|
+
'Rock Organ',
|
221
|
+
'Church Organ',
|
222
|
+
'Reed Organ',
|
223
|
+
'Accordion',
|
224
|
+
'Harmonica',
|
225
|
+
'Tango Accordion',
|
226
|
+
#--
|
227
|
+
# Guitars
|
228
|
+
#++
|
229
|
+
'Acoustic Guitar (nylon)',
|
230
|
+
'Acoustic Guitar (steel)',
|
231
|
+
'Electric Guitar (jazz)',
|
232
|
+
'Electric Guitar (clean)',
|
233
|
+
'Electric Guitar (muted)',
|
234
|
+
'Overdriven Guitar',
|
235
|
+
'Distortion Guitar',
|
236
|
+
'Guitar harmonics',
|
237
|
+
#--
|
238
|
+
# Basses
|
239
|
+
#++
|
240
|
+
'Acoustic Bass',
|
241
|
+
'Electric Bass (finger)',
|
242
|
+
'Electric Bass (pick)',
|
243
|
+
'Fretless Bass',
|
244
|
+
'Slap Bass 1',
|
245
|
+
'Slap Bass 2',
|
246
|
+
'Synth Bass 1',
|
247
|
+
'Synth Bass 2',
|
248
|
+
#--
|
249
|
+
# Strings
|
250
|
+
#++
|
251
|
+
'Violin',
|
252
|
+
'Viola',
|
253
|
+
'Cello',
|
254
|
+
'Contrabass',
|
255
|
+
'Tremolo Strings',
|
256
|
+
'Pizzicato Strings',
|
257
|
+
'Orchestral Harp',
|
258
|
+
'Timpani',
|
259
|
+
#--
|
260
|
+
# Ensemble strings and voices
|
261
|
+
#++
|
262
|
+
'String Ensemble 1',
|
263
|
+
'String Ensemble 2',
|
264
|
+
'SynthStrings 1',
|
265
|
+
'SynthStrings 2',
|
266
|
+
'Choir Aahs',
|
267
|
+
'Voice Oohs',
|
268
|
+
'Synth Voice',
|
269
|
+
'Orchestra Hit',
|
270
|
+
#--
|
271
|
+
# Brass
|
272
|
+
#++
|
273
|
+
'Trumpet',
|
274
|
+
'Trombone',
|
275
|
+
'Tuba',
|
276
|
+
'Muted Trumpet',
|
277
|
+
'French Horn',
|
278
|
+
'Brass Section',
|
279
|
+
'SynthBrass 1',
|
280
|
+
'SynthBrass 2',
|
281
|
+
#--
|
282
|
+
# Reeds
|
283
|
+
#++
|
284
|
+
'Soprano Sax', # 64
|
285
|
+
'Alto Sax',
|
286
|
+
'Tenor Sax',
|
287
|
+
'Baritone Sax',
|
288
|
+
'Oboe',
|
289
|
+
'English Horn',
|
290
|
+
'Bassoon',
|
291
|
+
'Clarinet',
|
292
|
+
#--
|
293
|
+
# Pipes
|
294
|
+
#++
|
295
|
+
'Piccolo',
|
296
|
+
'Flute',
|
297
|
+
'Recorder',
|
298
|
+
'Pan Flute',
|
299
|
+
'Blown Bottle',
|
300
|
+
'Shakuhachi',
|
301
|
+
'Whistle',
|
302
|
+
'Ocarina',
|
303
|
+
#--
|
304
|
+
# Synth Leads
|
305
|
+
#++
|
306
|
+
'Lead 1 (square)',
|
307
|
+
'Lead 2 (sawtooth)',
|
308
|
+
'Lead 3 (calliope)',
|
309
|
+
'Lead 4 (chiff)',
|
310
|
+
'Lead 5 (charang)',
|
311
|
+
'Lead 6 (voice)',
|
312
|
+
'Lead 7 (fifths)',
|
313
|
+
'Lead 8 (bass + lead)',
|
314
|
+
#--
|
315
|
+
# Synth Pads
|
316
|
+
#++
|
317
|
+
'Pad 1 (new age)',
|
318
|
+
'Pad 2 (warm)',
|
319
|
+
'Pad 3 (polysynth)',
|
320
|
+
'Pad 4 (choir)',
|
321
|
+
'Pad 5 (bowed)',
|
322
|
+
'Pad 6 (metallic)',
|
323
|
+
'Pad 7 (halo)',
|
324
|
+
'Pad 8 (sweep)',
|
325
|
+
#--
|
326
|
+
# Effects
|
327
|
+
#++
|
328
|
+
'FX 1 (rain)',
|
329
|
+
'FX 2 (soundtrack)',
|
330
|
+
'FX 3 (crystal)',
|
331
|
+
'FX 4 (atmosphere)',
|
332
|
+
'FX 5 (brightness)',
|
333
|
+
'FX 6 (goblins)',
|
334
|
+
'FX 7 (echoes)',
|
335
|
+
'FX 8 (sci-fi)',
|
336
|
+
#--
|
337
|
+
# Ethnic
|
338
|
+
#++
|
339
|
+
'Sitar',
|
340
|
+
'Banjo',
|
341
|
+
'Shamisen',
|
342
|
+
'Koto',
|
343
|
+
'Kalimba',
|
344
|
+
'Bag pipe',
|
345
|
+
'Fiddle',
|
346
|
+
'Shanai',
|
347
|
+
#--
|
348
|
+
# Percussion
|
349
|
+
#++
|
350
|
+
'Tinkle Bell',
|
351
|
+
'Agogo',
|
352
|
+
'Steel Drums',
|
353
|
+
'Woodblock',
|
354
|
+
'Taiko Drum',
|
355
|
+
'Melodic Tom',
|
356
|
+
'Synth Drum',
|
357
|
+
'Reverse Cymbal',
|
358
|
+
#--
|
359
|
+
# Sound Effects
|
360
|
+
#++
|
361
|
+
'Guitar Fret Noise',
|
362
|
+
'Breath Noise',
|
363
|
+
'Seashore',
|
364
|
+
'Bird Tweet',
|
365
|
+
'Telephone Ring',
|
366
|
+
'Helicopter',
|
367
|
+
'Applause',
|
368
|
+
'Gunshot'
|
369
|
+
]
|
425
370
|
|
371
|
+
# GM drum notes start at 35 (C), so subtrack GM_DRUM_NOTE_LOWEST from your
|
372
|
+
# note number before using this array.
|
373
|
+
GM_DRUM_NOTE_LOWEST = 35
|
374
|
+
# General MIDI drum channel note names.
|
375
|
+
GM_DRUM_NOTE_NAMES = [
|
376
|
+
'Acoustic Bass Drum', # 35, C
|
377
|
+
'Bass Drum 1', # 36, C#
|
378
|
+
'Side Stick', # 37, D
|
379
|
+
'Acoustic Snare', # 38, D#
|
380
|
+
'Hand Clap', # 39, E
|
381
|
+
'Electric Snare', # 40, F
|
382
|
+
'Low Floor Tom', # 41, F#
|
383
|
+
'Closed Hi Hat', # 42, G
|
384
|
+
'High Floor Tom', # 43, G#
|
385
|
+
'Pedal Hi-Hat', # 44, A
|
386
|
+
'Low Tom', # 45, A#
|
387
|
+
'Open Hi-Hat', # 46, B
|
388
|
+
'Low-Mid Tom', # 47, C
|
389
|
+
'Hi Mid Tom', # 48, C#
|
390
|
+
'Crash Cymbal 1', # 49, D
|
391
|
+
'High Tom', # 50, D#
|
392
|
+
'Ride Cymbal 1', # 51, E
|
393
|
+
'Chinese Cymbal', # 52, F
|
394
|
+
'Ride Bell', # 53, F#
|
395
|
+
'Tambourine', # 54, G
|
396
|
+
'Splash Cymbal', # 55, G#
|
397
|
+
'Cowbell', # 56, A
|
398
|
+
'Crash Cymbal 2', # 57, A#
|
399
|
+
'Vibraslap', # 58, B
|
400
|
+
'Ride Cymbal 2', # 59, C
|
401
|
+
'Hi Bongo', # 60, C#
|
402
|
+
'Low Bongo', # 61, D
|
403
|
+
'Mute Hi Conga', # 62, D#
|
404
|
+
'Open Hi Conga', # 63, E
|
405
|
+
'Low Conga', # 64, F
|
406
|
+
'High Timbale', # 65, F#
|
407
|
+
'Low Timbale', # 66, G
|
408
|
+
'High Agogo', # 67, G#
|
409
|
+
'Low Agogo', # 68, A
|
410
|
+
'Cabasa', # 69, A#
|
411
|
+
'Maracas', # 70, B
|
412
|
+
'Short Whistle', # 71, C
|
413
|
+
'Long Whistle', # 72, C#
|
414
|
+
'Short Guiro', # 73, D
|
415
|
+
'Long Guiro', # 74, D#
|
416
|
+
'Claves', # 75, E
|
417
|
+
'Hi Wood Block', # 76, F
|
418
|
+
'Low Wood Block', # 77, F#
|
419
|
+
'Mute Cuica', # 78, G
|
420
|
+
'Open Cuica', # 79, G#
|
421
|
+
'Mute Triangle', # 80, A
|
422
|
+
'Open Triangle' # 81, A#
|
423
|
+
]
|
426
424
|
end
|