Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9



Download 0.65 Mb.
Page23/30
Date conversion08.07.2018
Size0.65 Mb.
1   ...   19   20   21   22   23   24   25   26   ...   30

MIDI

MIDI is a system for musical instruments to communicate with each other and with computers.


If you want to control MIDI software with GlovePIE, you will need to download and install MidiYoke from http://www.midiox.com/myoke.htm. MIDI Yoke will also allow you to read MIDI output from other programs.
Otherwise you can only control the soundcard or external MIDI devices. You can also read input from MIDI devices.
MIDI devices can be plugged into your joystick port, if you have the right cable. Then you can use them for input.

MIDI Ports


Each computer may have multiple MIDI output ports, and multiple MIDI input ports. The output ports will include your sound card, software synthesisers, the external ports on the back of your computer, and MIDI Yoke ports. Input ports will include the input ports on the back of your soundcard, and the MIDI Yoke ports. There is no guarantee that input and output ports match up. There is also an output port called the “MIDI Mapper” which in Windows 3.1 was a complicated system for forwarding MIDI messages to different devices, but now it is just a setting in control panel which forwards everything to a chosen device.
Each MIDI port has 16 channels. It is possible to have multiple MIDI devices connected to the same port, but for each one to be listening to a separate channel. It is also possible for one MIDI device to use all the channels, with each channel representing a separate virtual instrument.
You can set which MIDI output port you want GlovePIE to use, like this:
midi.DeviceOut = 2
Where 1 is the first output port, and 0 is the MIDI mapper.
Future writes to midi values will then go to port 2.
You can set the input port like this:
midi.DeviceIn = 2
But there is no guarantee that input port 2 is connected to the same device as output port 2. In fact, most of the time it won’t be.
If you want to know what the name of that device is, use:
debug = midi.OutDevName
or
debug = midi.InDevName
You can also look at OutVersion, OutTech, InVersion and InTech.
Instead of using the default ports that you set with DeviceOut and DeviceIn, you can also use several ports at once, by explicitly putting them after the “midi” part of the value. For example to set the volume on (the default channel) of MIDI output port 2:
midi2.Volume = 50%
Or you could do the same thing like this:
midi.DeviceOut = 2

midi.Volume = 50%


A better way to control output ports, is to use the different port categories:
midi.mapper.volume = 50%

midi.soundcard.volume = 50%

midi.software.volume = 50%

midi.wavetable.volume = 50%

midi.playback.volume = 50%

midi.yoke2.volume = 50%

midi.external2.volume = 50%
You can optionally put a number after the category to use the nth device in that category.
If you want to set the default output device to one of those, then you can read from the DeviceOut or DeviceIn on one of those devices and use it to set the default device. Observe:
midi.DeviceOut = midi.yoke3.DeviceOut
That will set the default output port to the 3rd MIDI Yoke port.

MIDI Channels

Each MIDI port has 16 channels, numbered 1 to 16. You can set the default channel like this:


midi.DefaultChannel = 4
Each channel has its own instrument number, volume and other parameters, and each channel can play multiple notes at once.
Or you can specify the channel explicitly, like this:
midi.Channel4.Volume = 50%
You can specify both the port and the channel like this:
midi.Yoke3.Channel4.Volume = 50%
All the channels behave the same, except for Channel 10 on General MIDI devices (which most devices are these days). Channel 10 is always in percussion mode, and will play a different percussion instrument for each note of the scale. You can turn General Midi on or off by setting:
midi.GeneralMidi = True

or


midi.GeneralMidi = False
If you tell GlovePIE to play a percussion instrument, it will automatically do it on channel 10, regardless of which channel you specify.

Playing notes

You can turn notes on and off by setting the note to either true or false. For example to play middle C when the press the space bar:


midi.MiddleC = space
Middle C is octave 5, so you can also write it like this:
midi.C5 = space
You can also play other notes like this:
midi.FSharp8 = Enter
The lowest note is C0. The highest note is G10.

Striking notes with a particular velocity

If you want more control over how fast the note is struck, you can set the velocity instead. If you turn notes on and off like above they will always be struck with a velocity of 50%. But you can also turn notes on by setting their velocity:


if pressed(Space) then midi.C5Velocity = 80%

if released(Space) then midi.C5Velocity = 0


Note that velocities are between 0 and 1 (80% is the same as 0.8). Setting the velocity to 0 turns the note off. Notes are always released with a release-velocity of 50%.
Some instruments will sound the same whatever velocity you use.

Applying Pressure to a note

You can also apply extra pressure to a note when it is down. By default 0 extra pressure is applied. Applying extra pressure to a note may not have any effect on most instruments. The extra pressure is called “aftertouch”.


if pressed(space) then

midi.C5 = true

midi.C5Aftertouch = 20%

else


midi.C5 = false

end if
You can also apply extra pressure to every note that is played on that channel by setting the ChannelPressure:


midi.ChannelPressure = 20%

Playing notes by number

You can also play a note by setting midi.FirstNote to the number of the note you want to play. There are 12 notes per octave, including sharps and flats (anyone who tells you 8 is an idiot, even without sharps and flats there are only 7). C0 is note number 0. C1 is note number 12. MiddleC is note number 60. G10 is note number 127. You need to set it to -1 to turn the note off.


if pressed(Space) then midi.FirstNote = 60

if released(Space) then midi.FirstNote = -1


There is also a SecondNote, ThirdNote, and FourthNote, so you can play 4 notes by number at once.
These notes are all struck (and released) with a velocity of 50%.
You can’t read the note you are playing, so if you want to remember it, store it in a variable. Reading from midi.FirstNote will read from the MIDI input device instead!

1   ...   19   20   21   22   23   24   25   26   ...   30


The database is protected by copyright ©dentisty.org 2016
send message

    Main page