MIDIGetGMPgm

Returns the General MIDI program name (ie, "Grand Piano") for the specified MIDI program number, or returns the corresponding MIDI program number for a GM program name. When MIDIGetEvent() matches a "Program" type of event, it sets MIDIEvent.!Data1 to the program number. MIDIGetGMPgm() can be used to retrieve the matching GM program name.

Synopsis

info = MIDIGetGMPgm(name, number)

Args

name is the GM program name for which the MIDI program number is to be returned. If omitted, then number is used instead.

number is the MIDI program number for which the GM name is to be returned.

If both name and number are omitted, then the currently selected event's program number is used to fetch the corresponding GM name.

Returns

The program number or GM name, or an empty string if an error.

Notes

This chart shows the names of all 128 GM Instruments, and the MIDI Program Change numbers which select those Instruments.

Prog#   Instrument          Prog#    Instrument
 
0    Grand Piano             8   Celesta
1    Bright Piano            9   Glockenspiel
2    Elec. Grand            10   Music Box
3    Honky Tonk             11   Vibraphone
4    Elec. Piano 1          12   Marimba
5    Elec. Piano 2          13   Xylophone
6    Harpsichord            14   Tubular Bells
7    Clavinet               15   Dulcimer
 
16   Drawbar Organ          24   Nylon Guitar
17   Perc. Organ            25   Steel Guitar
18   Rock Organ             26   Jazz Guitar
19   Pipe Organ             27   Clean Guitar
20   Reed Organ             28   Muted Guitar
21   Accordian              29   Overdrive Gtr
22   Harmonica              30   Distorted Gtr
23   Tango Accord.          31   Harmonics Gtr
 
32   Acous. Bass            40   Violin
33   Fingered Bass          41   Viola
34   Picked Bass            42   Cello
35   Fretless Bass          43   Contra Bass
36   Slap 1 Bass            44   Tremolo Strs
37   Slap 2 Bass            45   Pizzicato Str
38   Synth Bass 1           46   Orch. Harp
39   Synth Bass 2           47   Timpani

48   Strings                56   Trumpet
49   Slow Strings           57   Trombone
50   Syn. 1 String          58   Tuba
51   Syn. 2 String          59   Muted Trumpet
52   Choir Aahs             60   French Horn
53   Voice Oohs             61   Brass 1
54   Synth Voice            62   Syn. Brass 1
55   Orchestra Hit          63   Syn. Brass 2

64   Soprano Sax            72   Piccolo
65   Alto Sax               73   Flute
66   Tenor Sax              74   Recorder
67   Baritone Sax           75   Pan Flute
68   Oboe                   76   Blown Bottle
69   English Horn           77   Skakuhachi
70   Bassoon                78   Whistle
71   Clarinet               79   Ocarina

80   Square Wave            88   New Age
81   Saw Wave               89   Warm Pad
82   Syn. Calliope          90   Polysynth
83   Chiffer Lead           91   Space Voice
84   Charang                92   Bowed Glass
85   Solo Voice             93   Metal Pad
86   Saw Fifths             94   Halo Pad
87   Bass + Lead            95   Sweep Pad
 
 96  Ice Rain               104   Sitar
 97  Soundtrack             105   Banjo
 98  Crystal                106   Shamisen
 99  Atmosphere             107   Koto
100  Brightness             108   Kalimba
101  Goblins                109   Bag Pipes
102  Echo Drops             110   Fiddle
103  Star Theme             111   Shannai

112  Tinkle Bell            120   Gt.Fret Noise
113  Agogo                  121   Breath Noise
114  Steel Drums            122   Seashore
115  Woodblock              123   Birds
116  Taiko                  124   Telephone
117  Melodic Tom            125   Helicopter
118  Synth Drum             126   Applause
119  Reverse Cym.           127   Gunshot
Prog# refers to the MIDI Program Change number that causes this Patch to be selected. Note that MIDI Rexx references program numbers from 0 (ie, the first program number is 0 -- not 1).

name can be a substring of a GM name (ie, "Piano" matches "Grand Piano"). Leading/trailing blanks and case are ignored.

Examples

/* Get the GM name corresponding to a program number of 0 */
name = MIDIGetGMPgm(0)
IF name \== "" THEN SAY 'GM name =' name

/* Query the current event's GM name */
name = MIDIGetGMPgm()
IF name \== "" THEN SAY 'GM name =' name

/* Display all GM names */
DO i = 0 TO 127
  name = MIDIGetGMPgm(i)
  IF name \== "" THEN SAY name
END