midilib 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +9 -4
  3. data/Rakefile +2 -6
  4. data/examples/from_scratch.rb +3 -5
  5. data/examples/measures_mbt.rb +4 -4
  6. data/examples/print_program_changes.rb +9 -9
  7. data/examples/reader2text.rb +188 -188
  8. data/examples/seq2text.rb +17 -17
  9. data/examples/split.rb +19 -19
  10. data/examples/strings.rb +14 -14
  11. data/examples/transpose.rb +31 -31
  12. data/html/IO.html +65 -169
  13. data/html/MIDI.html +138 -256
  14. data/html/MIDI/ActiveSense.html +89 -178
  15. data/html/MIDI/ChannelEvent.html +95 -183
  16. data/html/MIDI/ChannelPressure.html +105 -190
  17. data/html/MIDI/Clock.html +89 -178
  18. data/html/MIDI/Continue.html +89 -178
  19. data/html/MIDI/Controller.html +107 -192
  20. data/html/MIDI/Event.html +138 -222
  21. data/html/MIDI/IO.html +45 -157
  22. data/html/MIDI/IO/MIDIFile.html +596 -568
  23. data/html/MIDI/IO/SeqReader.html +272 -314
  24. data/html/MIDI/IO/SeqWriter.html +229 -305
  25. data/html/MIDI/KeySig.html +129 -211
  26. data/html/MIDI/MIDI.html +45 -154
  27. data/html/MIDI/MIDI/MIDI.html +45 -154
  28. data/html/MIDI/MIDI/MIDI/Array.html +87 -185
  29. data/html/MIDI/Marker.html +71 -170
  30. data/html/MIDI/Measure.html +95 -190
  31. data/html/MIDI/Measures.html +103 -193
  32. data/html/MIDI/MetaEvent.html +180 -253
  33. data/html/MIDI/NoteEvent.html +118 -204
  34. data/html/MIDI/NoteOff.html +95 -183
  35. data/html/MIDI/NoteOn.html +95 -183
  36. data/html/MIDI/PitchBend.html +106 -191
  37. data/html/MIDI/PolyPressure.html +106 -189
  38. data/html/MIDI/ProgramChange.html +105 -190
  39. data/html/MIDI/Realtime.html +98 -184
  40. data/html/MIDI/Sequence.html +246 -311
  41. data/html/MIDI/SongPointer.html +106 -191
  42. data/html/MIDI/SongSelect.html +105 -190
  43. data/html/MIDI/Start.html +89 -178
  44. data/html/MIDI/Stop.html +89 -178
  45. data/html/MIDI/SystemCommon.html +71 -170
  46. data/html/MIDI/SystemExclusive.html +108 -193
  47. data/html/MIDI/SystemReset.html +89 -178
  48. data/html/MIDI/Tempo.html +135 -213
  49. data/html/MIDI/TimeSig.html +135 -214
  50. data/html/MIDI/Track.html +217 -291
  51. data/html/MIDI/TuneRequest.html +98 -184
  52. data/html/MIDI/Utils.html +89 -189
  53. data/html/README_rdoc.html +237 -257
  54. data/html/TODO_rdoc.html +64 -139
  55. data/html/created.rid +14 -14
  56. data/html/css/fonts.css +167 -0
  57. data/html/{rdoc.css → css/rdoc.css} +265 -218
  58. data/html/fonts/Lato-Light.ttf +0 -0
  59. data/html/fonts/Lato-LightItalic.ttf +0 -0
  60. data/html/fonts/Lato-Regular.ttf +0 -0
  61. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  62. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  63. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  64. data/html/images/add.png +0 -0
  65. data/html/images/arrow_up.png +0 -0
  66. data/html/images/delete.png +0 -0
  67. data/html/images/tag_blue.png +0 -0
  68. data/html/index.html +187 -169
  69. data/html/js/darkfish.js +41 -33
  70. data/html/js/jquery.js +4 -18
  71. data/html/js/navigation.js.gz +0 -0
  72. data/html/js/search.js +20 -5
  73. data/html/js/search_index.js +1 -1
  74. data/html/js/search_index.js.gz +0 -0
  75. data/html/js/searcher.js.gz +0 -0
  76. data/html/table_of_contents.html +1111 -498
  77. data/install.rb +43 -32
  78. data/lib/midilib/consts.rb +407 -407
  79. data/lib/midilib/event.rb +295 -294
  80. data/lib/midilib/info.rb +5 -5
  81. data/lib/midilib/io/midifile.rb +266 -267
  82. data/lib/midilib/io/seqreader.rb +106 -106
  83. data/lib/midilib/io/seqwriter.rb +59 -60
  84. data/lib/midilib/measure.rb +69 -69
  85. data/lib/midilib/sequence.rb +68 -70
  86. data/lib/midilib/track.rb +96 -102
  87. data/lib/midilib/utils.rb +15 -15
  88. data/test/event_equality.rb +50 -50
  89. data/test/test_event.rb +120 -122
  90. data/test/test_io.rb +35 -48
  91. data/test/test_sequence.rb +60 -60
  92. data/test/test_track.rb +154 -154
  93. data/test/test_varlen.rb +23 -25
  94. metadata +65 -57
data/install.rb CHANGED
@@ -5,53 +5,64 @@
5
5
  # This script installs midilib into the Ruby site-local library directory.
6
6
  #
7
7
  # Author:: Jim Menard (mailto:jim@jimmenard.com)
8
- # Copyright:: Copyright (c) 2003-2012 by Jim Menard
8
+ # Copyright:: Copyright (c) 2003-2013 by Jim Menard
9
9
  # License:: Distributed under the same license as Ruby.
10
10
  #
11
11
 
12
12
  require 'getoptlong'
13
- require 'ftools'
14
13
  require 'find'
14
+ begin
15
+ require 'ftools'
16
+ def mkdirs(dir); File.makedirs(dir); end
17
+ def install(*args); File.install(*args); end
18
+ rescue LoadError
19
+ require 'fileutils'
20
+ def mkdirs(dir); FileUtils.mkdir_p(dir); end
21
+ def install(*args)
22
+ args[2] = {mode: args[2], verbose: args[3]}
23
+ args.pop
24
+ FileUtils.install(*args)
25
+ end
26
+ end
15
27
 
16
28
  SOURCE_DIR = 'lib'
17
29
  LIB_DIR = 'midilib'
18
30
  IO_DIR = File.join(LIB_DIR, 'io')
19
31
 
20
32
  def instdir
21
- g = GetoptLong.new(['--install-dir', '-i', GetoptLong::REQUIRED_ARGUMENT])
22
- g.each { | name, arg |
23
- if name == '--install-dir'
24
- return arg
25
- else
26
- $stderr.puts "usage: $0 [--install-dir dir]"
27
- end
28
- }
33
+ g = GetoptLong.new(['--install-dir', '-i', GetoptLong::REQUIRED_ARGUMENT])
34
+ g.each do |name, arg|
35
+ if name == '--install-dir'
36
+ return arg
37
+ else
38
+ $stderr.puts "usage: $0 [--install-dir dir]"
39
+ end
40
+ end
29
41
 
30
- begin
31
- require 'rbconfig'
32
- libdir = Config::CONFIG['sitedir'] + "/" +
33
- Config::CONFIG['MAJOR'] + "." +
34
- Config::CONFIG['MINOR']
35
- rescue ScriptError
36
- $LOAD_PATH.each do |l|
37
- if l =~ /site_ruby/ && l =~ /\d$/ && l !~ /#{PLATFORM}/
38
- libdir = l
39
- break
40
- end
41
- end
42
- STDERR.puts "Can't find required file `rbconfig.rb'."
43
- STDERR.puts "The `midilib' files need to be installed manually in" +
44
- " #{libdir}"
42
+ begin
43
+ require 'rbconfig'
44
+ libdir = Config::CONFIG['sitedir'] + "/" +
45
+ Config::CONFIG['MAJOR'] + "." +
46
+ Config::CONFIG['MINOR']
47
+ rescue ScriptError
48
+ $LOAD_PATH.each do |l|
49
+ if l =~ /site_ruby/ && l =~ /\d$/ && l !~ /#{PLATFORM}/
50
+ libdir = l
51
+ break
52
+ end
45
53
  end
46
- return libdir
54
+ STDERR.puts "Can't find required file `rbconfig.rb'."
55
+ STDERR.puts "The `midilib' files need to be installed manually in #{libdir}"
56
+ end
57
+ return libdir
47
58
  end
48
59
 
49
60
  INSTALL_DIR = instdir()
50
61
  files = Dir.chdir('lib') { Dir['**/*.rb'] }
51
62
 
52
- files.each { | f |
53
- dir = File.dirname(f)
54
- target_dir = File.join(INSTALL_DIR, dir)
55
- File.makedirs(target_dir) unless File.exist?(target_dir)
56
- File.install(File.join('lib', f), File.join(INSTALL_DIR, f), 0644, true)
57
- }
63
+ files.each do |f|
64
+ dir = File.dirname(f)
65
+ target_dir = File.join(INSTALL_DIR, dir)
66
+ mkdirs(target_dir) unless File.exist?(target_dir)
67
+ install(File.join('lib', f), File.join(INSTALL_DIR, f), 0644, true)
68
+ end
@@ -1,426 +1,426 @@
1
1
  # MIDI constants.
2
2
  module MIDI
3
3
 
4
- # Number of MIDI channels
5
- MIDI_CHANNELS = 16
6
- # Number of note per MIDI channel
7
- NOTES_PER_CHANNEL = 128
4
+ # Number of MIDI channels
5
+ MIDI_CHANNELS = 16
6
+ # Number of note per MIDI channel
7
+ NOTES_PER_CHANNEL = 128
8
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
9
  #--
250
- # Strings
10
+ # Standard MIDI File meta event defs.
251
11
  #++
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
- #--
272
- # Brass
273
- #++
274
- "Trumpet",
275
- "Trombone",
276
- "Tuba",
277
- "Muted Trumpet",
278
- "French Horn",
279
- "Brass Section",
280
- "SynthBrass 1",
281
- "SynthBrass 2",
282
- #--
283
- # Reeds
284
- #++
285
- "Soprano Sax", # 64
286
- "Alto Sax",
287
- "Tenor Sax",
288
- "Baritone Sax",
289
- "Oboe",
290
- "English Horn",
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)",
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
+
315
29
  #--
316
- # Synth Pads
30
+ # Channel messages
317
31
  #++
318
- "Pad 1 (new age)",
319
- "Pad 2 (warm)",
320
- "Pad 3 (polysynth)",
321
- "Pad 4 (choir)",
322
- "Pad 5 (bowed)",
323
- "Pad 6 (metallic)",
324
- "Pad 7 (halo)",
325
- "Pad 8 (sweep)",
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
+
326
47
  #--
327
- # Effects
48
+ # System common messages
328
49
  #++
329
- "FX 1 (rain)",
330
- "FX 2 (soundtrack)",
331
- "FX 3 (crystal)",
332
- "FX 4 (atmosphere)",
333
- "FX 5 (brightness)",
334
- "FX 6 (goblins)",
335
- "FX 7 (echoes)",
336
- "FX 8 (sci-fi)",
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
+
337
61
  #--
338
- # Ethnic
62
+ # System realtime messages
339
63
  #++
340
- "Sitar",
341
- "Banjo",
342
- "Shamisen",
343
- "Koto",
344
- "Kalimba",
345
- "Bag pipe",
346
- "Fiddle",
347
- "Shanai",
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
+
348
98
  #--
349
- # Percussion
99
+ # Momentaries:
350
100
  #++
351
- "Tinkle Bell",
352
- "Agogo",
353
- "Steel Drums",
354
- "Woodblock",
355
- "Taiko Drum",
356
- "Melodic Tom",
357
- "Synth Drum",
358
- "Reverse Cymbal",
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
+
359
121
  #--
360
- # Sound Effects
122
+ # Channel mode message values
361
123
  #++
362
- "Guitar Fret Noise",
363
- "Breath Noise",
364
- "Seashore",
365
- "Bird Tweet",
366
- "Telephone Ring",
367
- "Helicopter",
368
- "Applause",
369
- "Gunshot"
370
- ]
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
+ #--
272
+ # Brass
273
+ #++
274
+ "Trumpet",
275
+ "Trombone",
276
+ "Tuba",
277
+ "Muted Trumpet",
278
+ "French Horn",
279
+ "Brass Section",
280
+ "SynthBrass 1",
281
+ "SynthBrass 2",
282
+ #--
283
+ # Reeds
284
+ #++
285
+ "Soprano Sax", # 64
286
+ "Alto Sax",
287
+ "Tenor Sax",
288
+ "Baritone Sax",
289
+ "Oboe",
290
+ "English Horn",
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)",
315
+ #--
316
+ # Synth Pads
317
+ #++
318
+ "Pad 1 (new age)",
319
+ "Pad 2 (warm)",
320
+ "Pad 3 (polysynth)",
321
+ "Pad 4 (choir)",
322
+ "Pad 5 (bowed)",
323
+ "Pad 6 (metallic)",
324
+ "Pad 7 (halo)",
325
+ "Pad 8 (sweep)",
326
+ #--
327
+ # Effects
328
+ #++
329
+ "FX 1 (rain)",
330
+ "FX 2 (soundtrack)",
331
+ "FX 3 (crystal)",
332
+ "FX 4 (atmosphere)",
333
+ "FX 5 (brightness)",
334
+ "FX 6 (goblins)",
335
+ "FX 7 (echoes)",
336
+ "FX 8 (sci-fi)",
337
+ #--
338
+ # Ethnic
339
+ #++
340
+ "Sitar",
341
+ "Banjo",
342
+ "Shamisen",
343
+ "Koto",
344
+ "Kalimba",
345
+ "Bag pipe",
346
+ "Fiddle",
347
+ "Shanai",
348
+ #--
349
+ # Percussion
350
+ #++
351
+ "Tinkle Bell",
352
+ "Agogo",
353
+ "Steel Drums",
354
+ "Woodblock",
355
+ "Taiko Drum",
356
+ "Melodic Tom",
357
+ "Synth Drum",
358
+ "Reverse Cymbal",
359
+ #--
360
+ # Sound Effects
361
+ #++
362
+ "Guitar Fret Noise",
363
+ "Breath Noise",
364
+ "Seashore",
365
+ "Bird Tweet",
366
+ "Telephone Ring",
367
+ "Helicopter",
368
+ "Applause",
369
+ "Gunshot"
370
+ ]
371
371
 
372
- # GM drum notes start at 35 (C), so subtrack GM_DRUM_NOTE_LOWEST from your
373
- # note number before using this array.
374
- GM_DRUM_NOTE_LOWEST = 35
375
- # General MIDI drum channel note names.
376
- GM_DRUM_NOTE_NAMES = [
377
- "Acoustic Bass Drum", # 35, C
378
- "Bass Drum 1", # 36, C#
379
- "Side Stick", # 37, D
380
- "Acoustic Snare", # 38, D#
381
- "Hand Clap", # 39, E
382
- "Electric Snare", # 40, F
383
- "Low Floor Tom", # 41, F#
384
- "Closed Hi Hat", # 42, G
385
- "High Floor Tom", # 43, G#
386
- "Pedal Hi-Hat", # 44, A
387
- "Low Tom", # 45, A#
388
- "Open Hi-Hat", # 46, B
389
- "Low-Mid Tom", # 47, C
390
- "Hi Mid Tom", # 48, C#
391
- "Crash Cymbal 1", # 49, D
392
- "High Tom", # 50, D#
393
- "Ride Cymbal 1", # 51, E
394
- "Chinese Cymbal", # 52, F
395
- "Ride Bell", # 53, F#
396
- "Tambourine", # 54, G
397
- "Splash Cymbal", # 55, G#
398
- "Cowbell", # 56, A
399
- "Crash Cymbal 2", # 57, A#
400
- "Vibraslap", # 58, B
401
- "Ride Cymbal 2", # 59, C
402
- "Hi Bongo", # 60, C#
403
- "Low Bongo", # 61, D
404
- "Mute Hi Conga", # 62, D#
405
- "Open Hi Conga", # 63, E
406
- "Low Conga", # 64, F
407
- "High Timbale", # 65, F#
408
- "Low Timbale", # 66, G
409
- "High Agogo", # 67, G#
410
- "Low Agogo", # 68, A
411
- "Cabasa", # 69, A#
412
- "Maracas", # 70, B
413
- "Short Whistle", # 71, C
414
- "Long Whistle", # 72, C#
415
- "Short Guiro", # 73, D
416
- "Long Guiro", # 74, D#
417
- "Claves", # 75, E
418
- "Hi Wood Block", # 76, F
419
- "Low Wood Block", # 77, F#
420
- "Mute Cuica", # 78, G
421
- "Open Cuica", # 79, G#
422
- "Mute Triangle", # 80, A
423
- "Open Triangle" # 81, A#
424
- ]
372
+ # GM drum notes start at 35 (C), so subtrack GM_DRUM_NOTE_LOWEST from your
373
+ # note number before using this array.
374
+ GM_DRUM_NOTE_LOWEST = 35
375
+ # General MIDI drum channel note names.
376
+ GM_DRUM_NOTE_NAMES = [
377
+ "Acoustic Bass Drum", # 35, C
378
+ "Bass Drum 1", # 36, C#
379
+ "Side Stick", # 37, D
380
+ "Acoustic Snare", # 38, D#
381
+ "Hand Clap", # 39, E
382
+ "Electric Snare", # 40, F
383
+ "Low Floor Tom", # 41, F#
384
+ "Closed Hi Hat", # 42, G
385
+ "High Floor Tom", # 43, G#
386
+ "Pedal Hi-Hat", # 44, A
387
+ "Low Tom", # 45, A#
388
+ "Open Hi-Hat", # 46, B
389
+ "Low-Mid Tom", # 47, C
390
+ "Hi Mid Tom", # 48, C#
391
+ "Crash Cymbal 1", # 49, D
392
+ "High Tom", # 50, D#
393
+ "Ride Cymbal 1", # 51, E
394
+ "Chinese Cymbal", # 52, F
395
+ "Ride Bell", # 53, F#
396
+ "Tambourine", # 54, G
397
+ "Splash Cymbal", # 55, G#
398
+ "Cowbell", # 56, A
399
+ "Crash Cymbal 2", # 57, A#
400
+ "Vibraslap", # 58, B
401
+ "Ride Cymbal 2", # 59, C
402
+ "Hi Bongo", # 60, C#
403
+ "Low Bongo", # 61, D
404
+ "Mute Hi Conga", # 62, D#
405
+ "Open Hi Conga", # 63, E
406
+ "Low Conga", # 64, F
407
+ "High Timbale", # 65, F#
408
+ "Low Timbale", # 66, G
409
+ "High Agogo", # 67, G#
410
+ "Low Agogo", # 68, A
411
+ "Cabasa", # 69, A#
412
+ "Maracas", # 70, B
413
+ "Short Whistle", # 71, C
414
+ "Long Whistle", # 72, C#
415
+ "Short Guiro", # 73, D
416
+ "Long Guiro", # 74, D#
417
+ "Claves", # 75, E
418
+ "Hi Wood Block", # 76, F
419
+ "Low Wood Block", # 77, F#
420
+ "Mute Cuica", # 78, G
421
+ "Open Cuica", # 79, G#
422
+ "Mute Triangle", # 80, A
423
+ "Open Triangle" # 81, A#
424
+ ]
425
425
 
426
426
  end