You can play percussion instruments by setting one of the percussion instruments:
midi.AcousticBassDrum = space
AcousticBassDrum, BassDrum2, SideStick, AcousticSnare, HandClap, ElectricSnare, LowFloorTom, ClosedHiHat, HighFloorTom, PedalHiHat, LowTom, OpenHiHat, LowMidTom, HighMidTom, CrashCymbal1, HighTom, RideCymbal1, ChineseCymbal, RideBell, Tambourine, SplashCymbal, Cowbell, CrashCymbal2, Vibraslap, RideCymbal2, HiBongo, LowBongo, MuteHiConga, OpenHiConga, LowConga, HighTimbale, LowTimbale, HighAgogo, LowAgogo, Cabasa, Maracas, ShortWhistle, LongWhistle, ShortGuiro, LongGuiro, Claves, HiWoodBlock, LowWoodBlock, MuteCuica, OpenCuica, MuteTriangle, OpenTriangle
You can also set other percussion instruments by setting Percussion0 to Percussion127.
You can read whether notes are being played on a MIDI input device like this:
debug = midi.MiddleC
or you can read by number by using midi.FirstNote (SecondNote, ThirdNote and FourthNote don’t work for MIDI input yet).
if midi.FirstNote = 60 then say(“hello”)
You can use these methods to control games by using a MIDI keyboard:
Space = midi.MiddleC
Up = midi.MiddleDSharp
Down = midi.MiddleE
Left = midi.MiddleD
Right = midi.MiddleE
You can also read the velocities and aftertouches.
Setting the instrument
You can set the instrument to a number between 1 and 128 by setting midi.Instrument. See a midi instrument chart on the internet if you want to know what each instrument is.
If you normally use instrument numbers between 0 and 127, you can set midi.Instrument0 instead.
Note that each channel has its own instrument (except channel 10 on GeneralMidi)
By default instrument 1 is used, which is normally a piano.
If your instrument contains multiple banks of instruments, you can also set BankSelectLevel. But you need to divide by 16383… for example, to set it to bank 2:
midi.BankSelectLevel = 2 / 16383
The first bank is bank 0. Instrument banks may have no effect on some devices.
You can also set the pitch bend using the pitch wheel.
The pitch wheel can be set to a value between 0 and 1. Setting it to 0.5 means no effect.
midi.PitchWheel = 50%
Each channel has its own Pitch Wheel.
You can also try setting the PitchBendRange to change the range that the maximum pitch bend represents, in semitones.
Controls and Change Control messages
Each channel of each device has a set of 32 different 14-bit controls, numbered 0 to 31, and a set of 7-bit controls numbered 64 onwards. You can also access the two 7-bit components of the 14-bit controls separately, as Coarse and Fine controls or as byte controls numbered 0 to 63.
Some of them have standard names, and some of them just have numbers. But you can use any control by number if you prefer. Sometimes the controls aren’t used for their defined function.
For example, setting Midi.Volume is the same as setting Midi.Control7.
So you can either write this:
midi.Volume = 52.38%
midi.Control7 = 52.38%
It is a 14-bit control, so it is a value between 0 and 1, but with about 4 or 5 decimal places. In this case we are setting it to 0.5238
You can also access the coarse and fine parts separately, like this:
midi.Control7Coarse = 0.5
midi.Control7Fine = 0
The controls numbered 32 to 63 are the same as the fine parts of the controls numbered 0 to 31. So Control7Fine and Control38 are the same thing.
You can also use ByteControl7 to refer to the coarse part of Control7, or ByteControl38 to refer to the fine part of Control7.
Controls numbered 64 onwards are only 7-bit controls, and have no coarse or fine components. They are also set to a value between 0 and 1, but they will be accurate to less decimal places (about 2). They also often have names.
RPN (Registered Parameter Numbers)
MIDI also has RPN messages. These include:
MasterTuning, MasterTuningCoarse, MasterTuningFine, PitchBendRange, TuningProgramSelect and TuningBankSelect.
You can set them in GlovePIE like this:
Midi.PitchBendRange = 2 octaves
Midi.MasterTuning = -0.5 semitones // all notes will be off by half a note
I can’t guarantee these will work.
You can also set other RPN values manually, Eg. to set RPN 0,1 like this:
Midi.Control101 = 0 / 127
Midi.Control100 = 1 / 127
Midi.DataEntry = 0.75 // whatever value you want to set it to
Midi.Control101 = 127 / 127
Midi.Control100 = 127 / 127
NRPN (Non Registered Parameter Numbers)
There are no standard NRPN values (that’s the point of NRPN). But you can set them manually like this (for NRPN 0,1):
Midi.Control99 = 0 / 127
Midi.Control98 = 1 / 127
Midi.DataEntry = 0.75 // or whatever value
Midi.Control99 = 127 / 127
Midi.Control98 = 127 / 127
SysEx (System Exclusive)
You can set standard System Exclusive midi values like this:
Midi.GeneralMidi = true
Midi.MasterVolume = 76%
Midi.IdentityRequest = pressed(space)
If you want to set other System Exclusive midi values, you need to save them in a .SYX file. You can then tell GlovePIE to send that file like this:
Midi.SetupFile = “c:\coolsounds.syx”
You need to install SAPI 5.1, (It comes with Windows XP and Office XP) to use speech in GlovePIE. If you don’t have speech recognition installed, download and install this:
Unless you have XP Pro, in which case download and install this to get a later version:
If you just want the Mike and Mary text-to-speech voices for XP, download this: