wxMidi - A MIDI interface based on PortMidi
A database for MIDI (General MIDI Standard) instruments

The General MIDI (GM) Specification, published by the International MIDI Association, defines a set of general capabilities for General MIDI Instruments. The General MIDI Specification includes the definition of a General MIDI Sound Set (a patch map), a General MIDI Percussion map (mapping of percussion sounds to note numbers), and a set of General MIDI Performance capabilities (number of voices, types of MIDI messages recognized, etc.).

A MIDI sequence which has been generated for use on a General MIDI Instrument should play correctly on any General MIDI synthesizer or sound module.

The wxMidi package has a database with the General Midi standard (GM) instruments list. Instruments are grouped into sections, to facilitate the user to search for a specific instrument. The database includes methods to populate a combo box, a list box and, in general, any other control derived from wxControlWithItems.

wxMidiSystem is a singleton and, therefore, the constructor is not public. Access to the only instance must be through method GetInstance().

The General MIDI system specifies which instrument or sound corresponds with each program/patch number, but General MIDI does not specify how these sounds are produced. Thus, program number 0 should select the Acoustic Grand Piano sound on any General MIDI instrument. However, the Acoustic Grand Piano sound on two General MIDI synthesizers which use different synthesis techniques may sound quite different.

The General MIDI system utilizes MIDI channels 0-8 and 10-15 for chromatic instrument sounds, while channel number 9 is utilized for "key-based" percussion sounds.

For sounds on channels 0-8 and 10-15, the note number in a NoteOn message is used to select the pitch of the sound which will be played. For example if the Vibraphone instrument (program number 11) has been selected on channel 2, then playing note number 60 on channel 2 would play the middle C note (this would be the default note to pitch assignment on most instruments), and note number 59 on channel 2 would play B below middle C. Both notes would be played using the Vibraphone sound.

The General MIDI system specifies sounds (or instruments, in wxMidi terminology) by using program numbers 0 through 127. The list of all these 128 sounds could be obtained by using different methods; for example, by calling PopulateWithAllInstruments().

These instrument sounds are grouped into "sets" of related sounds. For example, instruments 0-7 are piano sounds, 8-15 are chromatic percussion sounds, 16-23 are organ sounds, 24-31 are guitar sounds, etc. Each one of these "sets" is called a "section" in the wxMidiDatabaseGM. There are two specific methods to deal with sections:

The list of instruments in a section is available through method PopulateWithInstruments().

As said, channel 9 reserved for "key-based" percussion sounds. For these "key-based" sounds, the note number data in a NoteOn message is used differently. Note numbers on channel 9 are used to select which drum sound will be played. For example, a NoteOn message on channel 9 with note number 60 will play a Hi Bongo drum sound. Note number 59 on channel 9 will play the Ride Cymbal 2 sound. The list of all key-based percussion sounds is accesible trhough method PopulateWithPercusionInstr().

The wxMidiDatabaseGM object includes additional methods for retrieving an instrument name given its number or the number of the section and the index inside the section. See, for example,