File: midi.c

package info (click to toggle)
brltty 6.8-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 35,896 kB
  • sloc: ansic: 150,447; java: 13,484; sh: 9,667; xml: 5,702; tcl: 2,634; makefile: 2,339; awk: 713; lisp: 366; python: 321; ml: 301
file content (484 lines) | stat: -rw-r--r-- 19,214 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
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
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
/*
 * BRLTTY - A background process providing access to the console screen (when in
 *          text mode) for a blind person using a refreshable braille display.
 *
 * Copyright (C) 1995-2025 by The BRLTTY Developers.
 *
 * BRLTTY comes with ABSOLUTELY NO WARRANTY.
 *
 * This is free software, placed under the terms of the
 * GNU Lesser General Public License, as published by the Free Software
 * Foundation; either version 2.1 of the License, or (at your option) any
 * later version. Please see the file LICENSE-LGPL for details.
 *
 * Web Page: http://brltty.app/
 *
 * This software is maintained by Dave Mielke <dave@mielke.cc>.
 */

#include "prologue.h"

#include "midi.h"

static const char *const midiInstrumentGroups[] = {
  // xgettext: This is the name of MIDI musical instrument group #1.
  [0X0] = strtext("Piano"),

  // xgettext: This is the name of MIDI musical instrument group #2.
  [0X1] = strtext("Chromatic Percussion"),

  // xgettext: This is the name of MIDI musical instrument group #3.
  [0X2] = strtext("Organ"),

  // xgettext: This is the name of MIDI musical instrument group #4.
  [0X3] = strtext("Guitar"),

  // xgettext: This is the name of MIDI musical instrument group #5.
  [0X4] = strtext("Bass"),

  // xgettext: This is the name of MIDI musical instrument group #6.
  [0X5] = strtext("Strings"),

  // xgettext: This is the name of MIDI musical instrument group #7.
  [0X6] = strtext("Ensemble"),

  // xgettext: This is the name of MIDI musical instrument group #8.
  [0X7] = strtext("Brass"),

  // xgettext: This is the name of MIDI musical instrument group #9.
  [0X8] = strtext("Reed"),

  // xgettext: This is the name of MIDI musical instrument group #10.
  [0X9] = strtext("Pipe"),

  // xgettext: This is the name of MIDI musical instrument group #11.
  // xgettext: (synth is a common short form for synthesizer)
  [0XA] = strtext("Synth Lead"),

  // xgettext: This is the name of MIDI musical instrument group #12.
  // xgettext: (synth is a common short form for synthesizer)
  [0XB] = strtext("Synth Pad"),

  // xgettext: This is the name of MIDI musical instrument group #13.
  // xgettext: (synth is a common short form for synthesizer)
  // xgettext: (FM is the acronym for Frequency Modulation)
  [0XC] = strtext("Synth FM"),

  // xgettext: This is the name of MIDI musical instrument group #14.
  [0XD] = strtext("Ethnic Instruments"),

  // xgettext: This is the name of MIDI musical instrument group #15.
  [0XE] = strtext("Percussive Instruments"),

  // xgettext: This is the name of MIDI musical instrument group #16.
  [0XF] = strtext("Sound Effects")
};

const char *const midiInstrumentTable[] = {
/* Piano */
  // xgettext: This is the name of MIDI musical instrument #1 (in the Piano group).
  [0X00] = strtext("Acoustic Grand Piano"),

  // xgettext: This is the name of MIDI musical instrument #2 (in the Piano group).
  [0X01] = strtext("Bright Acoustic Piano"),

  // xgettext: This is the name of MIDI musical instrument #3 (in the Piano group).
  [0X02] = strtext("Electric Grand Piano"),

  // xgettext: This is the name of MIDI musical instrument #4 (in the Piano group).
  [0X03] = strtext("Honkytonk Piano"),

  // xgettext: This is the name of MIDI musical instrument #5 (in the Piano group).
  [0X04] = strtext("Electric Piano 1"),

  // xgettext: This is the name of MIDI musical instrument #6 (in the Piano group).
  [0X05] = strtext("Electric Piano 2"),

  // xgettext: This is the name of MIDI musical instrument #7 (in the Piano group).
  [0X06] = strtext("Harpsichord"),

  // xgettext: This is the name of MIDI musical instrument #8 (in the Piano group).
  [0X07] = strtext("Clavinet"),

/* Chromatic Percussion */
  // xgettext: This is the name of MIDI musical instrument #9 (in the Chromatic Percussion group).
  [0X08] = strtext("Celesta"),

  // xgettext: This is the name of MIDI musical instrument #10 (in the Chromatic Percussion group).
  [0X09] = strtext("Glockenspiel"),

  // xgettext: This is the name of MIDI musical instrument #11 (in the Chromatic Percussion group).
  [0X0A] = strtext("Music Box"),

  // xgettext: This is the name of MIDI musical instrument #12 (in the Chromatic Percussion group).
  [0X0B] = strtext("Vibraphone"),

  // xgettext: This is the name of MIDI musical instrument #13 (in the Chromatic Percussion group).
  [0X0C] = strtext("Marimba"),

  // xgettext: This is the name of MIDI musical instrument #14 (in the Chromatic Percussion group).
  [0X0D] = strtext("Xylophone"),

  // xgettext: This is the name of MIDI musical instrument #15 (in the Chromatic Percussion group).
  [0X0E] = strtext("Tubular Bells"),

  // xgettext: This is the name of MIDI musical instrument #16 (in the Chromatic Percussion group).
  [0X0F] = strtext("Dulcimer"),

/* Organ */
  // xgettext: This is the name of MIDI musical instrument #17 (in the Organ group).
  [0X10] = strtext("Drawbar Organ"),

  // xgettext: This is the name of MIDI musical instrument #18 (in the Organ group).
  [0X11] = strtext("Percussive Organ"),

  // xgettext: This is the name of MIDI musical instrument #19 (in the Organ group).
  [0X12] = strtext("Rock Organ"),

  // xgettext: This is the name of MIDI musical instrument #20 (in the Organ group).
  [0X13] = strtext("Church Organ"),

  // xgettext: This is the name of MIDI musical instrument #21 (in the Organ group).
  [0X14] = strtext("Reed Organ"),

  // xgettext: This is the name of MIDI musical instrument #22 (in the Organ group).
  [0X15] = strtext("Accordion"),

  // xgettext: This is the name of MIDI musical instrument #23 (in the Organ group).
  [0X16] = strtext("Harmonica"),

  // xgettext: This is the name of MIDI musical instrument #24 (in the Organ group).
  [0X17] = strtext("Tango Accordion"),

/* Guitar */
  // xgettext: This is the name of MIDI musical instrument #25 (in the Guitar group).
  [0X18] = strtext("Acoustic Guitar (nylon)"),

  // xgettext: This is the name of MIDI musical instrument #26 (in the Guitar group).
  [0X19] = strtext("Acoustic Guitar (steel)"),

  // xgettext: This is the name of MIDI musical instrument #27 (in the Guitar group).
  [0X1A] = strtext("Electric Guitar (jazz)"),

  // xgettext: This is the name of MIDI musical instrument #28 (in the Guitar group).
  [0X1B] = strtext("Electric Guitar (clean)"),

  // xgettext: This is the name of MIDI musical instrument #29 (in the Guitar group).
  [0X1C] = strtext("Electric Guitar (muted)"),

  // xgettext: This is the name of MIDI musical instrument #30 (in the Guitar group).
  [0X1D] = strtext("Overdriven Guitar"),

  // xgettext: This is the name of MIDI musical instrument #31 (in the Guitar group).
  [0X1E] = strtext("Distortion Guitar"),

  // xgettext: This is the name of MIDI musical instrument #32 (in the Guitar group).
  [0X1F] = strtext("Guitar Harmonics"),

/* Bass */
  // xgettext: This is the name of MIDI musical instrument #33 (in the Bass group).
  [0X20] = strtext("Acoustic Bass"),

  // xgettext: This is the name of MIDI musical instrument #34 (in the Bass group).
  [0X21] = strtext("Electric Bass (finger)"),

  // xgettext: This is the name of MIDI musical instrument #35 (in the Bass group).
  [0X22] = strtext("Electric Bass (pick)"),

  // xgettext: This is the name of MIDI musical instrument #36 (in the Bass group).
  [0X23] = strtext("Fretless Bass"),

  // xgettext: This is the name of MIDI musical instrument #37 (in the Bass group).
  [0X24] = strtext("Slap Bass 1"),

  // xgettext: This is the name of MIDI musical instrument #38 (in the Bass group).
  [0X25] = strtext("Slap Bass 2"),

  // xgettext: This is the name of MIDI musical instrument #39 (in the Bass group).
  [0X26] = strtext("Synth Bass 1"),

  // xgettext: This is the name of MIDI musical instrument #40 (in the Bass group).
  [0X27] = strtext("Synth Bass 2"),

/* Strings */
  // xgettext: This is the name of MIDI musical instrument #41 (in the Strings group).
  [0X28] = strtext("Violin"),

  // xgettext: This is the name of MIDI musical instrument #42 (in the Strings group).
  [0X29] = strtext("Viola"),

  // xgettext: This is the name of MIDI musical instrument #43 (in the Strings group).
  [0X2A] = strtext("Cello"),

  // xgettext: This is the name of MIDI musical instrument #44 (in the Strings group).
  [0X2B] = strtext("Contrabass"),

  // xgettext: This is the name of MIDI musical instrument #45 (in the Strings group).
  [0X2C] = strtext("Tremolo Strings"),

  // xgettext: This is the name of MIDI musical instrument #46 (in the Strings group).
  [0X2D] = strtext("Pizzicato Strings"),

  // xgettext: This is the name of MIDI musical instrument #47 (in the Strings group).
  [0X2E] = strtext("Orchestral Harp"),

  // xgettext: This is the name of MIDI musical instrument #48 (in the Strings group).
  [0X2F] = strtext("Timpani"),

/* Ensemble */
  // xgettext: This is the name of MIDI musical instrument #49 (in the Ensemble group).
  [0X30] = strtext("String Ensemble 1"),

  // xgettext: This is the name of MIDI musical instrument #50 (in the Ensemble group).
  [0X31] = strtext("String Ensemble 2"),

  // xgettext: This is the name of MIDI musical instrument #51 (in the Ensemble group).
  [0X32] = strtext("SynthStrings 1"),

  // xgettext: This is the name of MIDI musical instrument #52 (in the Ensemble group).
  [0X33] = strtext("SynthStrings 2"),

  // xgettext: This is the name of MIDI musical instrument #53 (in the Ensemble group).
  [0X34] = strtext("Choir Aahs"),

  // xgettext: This is the name of MIDI musical instrument #54 (in the Ensemble group).
  [0X35] = strtext("Voice Oohs"),

  // xgettext: This is the name of MIDI musical instrument #55 (in the Ensemble group).
  [0X36] = strtext("Synth Voice"),

  // xgettext: This is the name of MIDI musical instrument #56 (in the Ensemble group).
  [0X37] = strtext("Orchestra Hit"),

/* Brass */
  // xgettext: This is the name of MIDI musical instrument #57 (in the Brass group).
  [0X38] = strtext("Trumpet"),

  // xgettext: This is the name of MIDI musical instrument #58 (in the Brass group).
  [0X39] = strtext("Trombone"),

  // xgettext: This is the name of MIDI musical instrument #59 (in the Brass group).
  [0X3A] = strtext("Tuba"),

  // xgettext: This is the name of MIDI musical instrument #60 (in the Brass group).
  [0X3B] = strtext("Muted Trumpet"),

  // xgettext: This is the name of MIDI musical instrument #61 (in the Brass group).
  [0X3C] = strtext("French Horn"),

  // xgettext: This is the name of MIDI musical instrument #62 (in the Brass group).
  [0X3D] = strtext("Brass Section"),

  // xgettext: This is the name of MIDI musical instrument #63 (in the Brass group).
  [0X3E] = strtext("SynthBrass 1"),

  // xgettext: This is the name of MIDI musical instrument #64 (in the Brass group).
  [0X3F] = strtext("SynthBrass 2"),

/* Reed */
  // xgettext: This is the name of MIDI musical instrument #65 (in the Reed group).
  [0X40] = strtext("Soprano Saxophone"),

  // xgettext: This is the name of MIDI musical instrument #66 (in the Reed group).
  [0X41] = strtext("Alto Saxophone"),

  // xgettext: This is the name of MIDI musical instrument #67 (in the Reed group).
  [0X42] = strtext("Tenor Saxophone"),

  // xgettext: This is the name of MIDI musical instrument #68 (in the Reed group).
  [0X43] = strtext("Baritone Saxophone"),

  // xgettext: This is the name of MIDI musical instrument #69 (in the Reed group).
  [0X44] = strtext("Oboe"),

  // xgettext: This is the name of MIDI musical instrument #70 (in the Reed group).
  [0X45] = strtext("English Horn"),

  // xgettext: This is the name of MIDI musical instrument #71 (in the Reed group).
  [0X46] = strtext("Bassoon"),

  // xgettext: This is the name of MIDI musical instrument #72 (in the Reed group).
  [0X47] = strtext("Clarinet"),

/* Pipe */
  // xgettext: This is the name of MIDI musical instrument #73 (in the Pipe group).
  [0X48] = strtext("Piccolo"),

  // xgettext: This is the name of MIDI musical instrument #74 (in the Pipe group).
  [0X49] = strtext("Flute"),

  // xgettext: This is the name of MIDI musical instrument #75 (in the Pipe group).
  [0X4A] = strtext("Recorder"),

  // xgettext: This is the name of MIDI musical instrument #76 (in the Pipe group).
  [0X4B] = strtext("Pan Flute"),

  // xgettext: This is the name of MIDI musical instrument #77 (in the Pipe group).
  [0X4C] = strtext("Blown Bottle"),

  // xgettext: This is the name of MIDI musical instrument #78 (in the Pipe group).
  [0X4D] = strtext("Shakuhachi"),

  // xgettext: This is the name of MIDI musical instrument #79 (in the Pipe group).
  [0X4E] = strtext("Whistle"),

  // xgettext: This is the name of MIDI musical instrument #80 (in the Pipe group).
  [0X4F] = strtext("Ocarina"),

/* Synth Lead */
  // xgettext: This is the name of MIDI musical instrument #81 (in the Synth Lead group).
  [0X50] = strtext("Lead 1 (square)"),

  // xgettext: This is the name of MIDI musical instrument #82 (in the Synth Lead group).
  [0X51] = strtext("Lead 2 (sawtooth)"),

  // xgettext: This is the name of MIDI musical instrument #83 (in the Synth Lead group).
  [0X52] = strtext("Lead 3 (calliope)"),

  // xgettext: This is the name of MIDI musical instrument #84 (in the Synth Lead group).
  [0X53] = strtext("Lead 4 (chiff)"),

  // xgettext: This is the name of MIDI musical instrument #85 (in the Synth Lead group).
  [0X54] = strtext("Lead 5 (charang)"),

  // xgettext: This is the name of MIDI musical instrument #86 (in the Synth Lead group).
  [0X55] = strtext("Lead 6 (voice)"),

  // xgettext: This is the name of MIDI musical instrument #87 (in the Synth Lead group).
  [0X56] = strtext("Lead 7 (fifths)"),

  // xgettext: This is the name of MIDI musical instrument #88 (in the Synth Lead group).
  [0X57] = strtext("Lead 8 (bass + lead)"),

/* Synth Pad */
  // xgettext: This is the name of MIDI musical instrument #89 (in the Synth Pad group).
  [0X58] = strtext("Pad 1 (new age)"),

  // xgettext: This is the name of MIDI musical instrument #90 (in the Synth Pad group).
  [0X59] = strtext("Pad 2 (warm)"),

  // xgettext: This is the name of MIDI musical instrument #91 (in the Synth Pad group).
  [0X5A] = strtext("Pad 3 (polysynth)"),

  // xgettext: This is the name of MIDI musical instrument #92 (in the Synth Pad group).
  [0X5B] = strtext("Pad 4 (choir)"),

  // xgettext: This is the name of MIDI musical instrument #93 (in the Synth Pad group).
  [0X5C] = strtext("Pad 5 (bowed)"),

  // xgettext: This is the name of MIDI musical instrument #94 (in the Synth Pad group).
  [0X5D] = strtext("Pad 6 (metallic)"),

  // xgettext: This is the name of MIDI musical instrument #95 (in the Synth Pad group).
  [0X5E] = strtext("Pad 7 (halo)"),

  // xgettext: This is the name of MIDI musical instrument #96 (in the Synth Pad group).
  [0X5F] = strtext("Pad 8 (sweep)"),

/* Synth FM */
  // xgettext: This is the name of MIDI musical instrument #97 (in the Synth FM group).
  [0X60] = strtext("FX 1 (rain)"),

  // xgettext: This is the name of MIDI musical instrument #98 (in the Synth FM group).
  [0X61] = strtext("FX 2 (soundtrack)"),

  // xgettext: This is the name of MIDI musical instrument #99 (in the Synth FM group).
  [0X62] = strtext("FX 3 (crystal)"),

  // xgettext: This is the name of MIDI musical instrument #100 (in the Synth FM group).
  [0X63] = strtext("FX 4 (atmosphere)"),

  // xgettext: This is the name of MIDI musical instrument #101 (in the Synth FM group).
  [0X64] = strtext("FX 5 (brightness)"),

  // xgettext: This is the name of MIDI musical instrument #102 (in the Synth FM group).
  [0X65] = strtext("FX 6 (goblins)"),

  // xgettext: This is the name of MIDI musical instrument #103 (in the Synth FM group).
  [0X66] = strtext("FX 7 (echoes)"),

  // xgettext: This is the name of MIDI musical instrument #104 (in the Synth FM group).
  // xgettext: (sci-fi is a common short form for science fiction)
  [0X67] = strtext("FX 8 (sci-fi)"),

/* Ethnic Instruments */
  // xgettext: This is the name of MIDI musical instrument #105 (in the Ethnic group).
  [0X68] = strtext("Sitar"),

  // xgettext: This is the name of MIDI musical instrument #106 (in the Ethnic group).
  [0X69] = strtext("Banjo"),

  // xgettext: This is the name of MIDI musical instrument #107 (in the Ethnic group).
  [0X6A] = strtext("Shamisen"),

  // xgettext: This is the name of MIDI musical instrument #108 (in the Ethnic group).
  [0X6B] = strtext("Koto"),

  // xgettext: This is the name of MIDI musical instrument #109 (in the Ethnic group).
  [0X6C] = strtext("Kalimba"),

  // xgettext: This is the name of MIDI musical instrument #110 (in the Ethnic group).
  [0X6D] = strtext("Bag Pipe"),

  // xgettext: This is the name of MIDI musical instrument #111 (in the Ethnic group).
  [0X6E] = strtext("Fiddle"),

  // xgettext: This is the name of MIDI musical instrument #112 (in the Ethnic group).
  [0X6F] = strtext("Shanai"),

/* Percussive Instruments */
  // xgettext: This is the name of MIDI musical instrument #113 (in the Percussive group).
  [0X70] = strtext("Tinkle Bell"),

  // xgettext: This is the name of MIDI musical instrument #114 (in the Percussive group).
  [0X71] = strtext("Agogo"),

  // xgettext: This is the name of MIDI musical instrument #115 (in the Percussive group).
  [0X72] = strtext("Steel Drums"),

  // xgettext: This is the name of MIDI musical instrument #116 (in the Percussive group).
  [0X73] = strtext("Woodblock"),

  // xgettext: This is the name of MIDI musical instrument #117 (in the Percussive group).
  [0X74] = strtext("Taiko Drum"),

  // xgettext: This is the name of MIDI musical instrument #118 (in the Percussive group).
  [0X75] = strtext("Melodic Tom"),

  // xgettext: This is the name of MIDI musical instrument #119 (in the Percussive group).
  [0X76] = strtext("Synth Drum"),

  // xgettext: This is the name of MIDI musical instrument #120 (in the Percussive group).
  [0X77] = strtext("Reverse Cymbal"),

/* Sound Effects */
  // xgettext: This is the name of MIDI musical instrument #121 (in the Sound Effects group).
  [0X78] = strtext("Guitar Fret Noise"),

  // xgettext: This is the name of MIDI musical instrument #122 (in the Sound Effects group).
  [0X79] = strtext("Breath Noise"),

  // xgettext: This is the name of MIDI musical instrument #123 (in the Sound Effects group).
  [0X7A] = strtext("Seashore"),

  // xgettext: This is the name of MIDI musical instrument #124 (in the Sound Effects group).
  [0X7B] = strtext("Bird Tweet"),

  // xgettext: This is the name of MIDI musical instrument #125 (in the Sound Effects group).
  [0X7C] = strtext("Telephone Ring"),

  // xgettext: This is the name of MIDI musical instrument #126 (in the Sound Effects group).
  [0X7D] = strtext("Helicopter"),

  // xgettext: This is the name of MIDI musical instrument #127 (in the Sound Effects group).
  [0X7E] = strtext("Applause"),

  // xgettext: This is the name of MIDI musical instrument #128 (in the Sound Effects group).
  [0X7F] = strtext("Gunshot")
};
const unsigned int midiInstrumentCount = ARRAY_COUNT(midiInstrumentTable);

const char *
midiGetInstrumentGroup (unsigned char instrument) {
  return midiInstrumentGroups[instrument >> 3];
}