First of all, xphat is a piece of free and open source software. I wrote it because I wanted a tool like this. I'm giving it away because I believe in the idea that most software should be free. I'm giving you the source code because you may want to modify the program, perhaps to improve it, or perhaps you might like to learn something from how I wrote it (or tell me how to to do it better). I want xphat to benefit from this kind of software development process. However, there are some restrictions on what you can do with xphat, since I'm releasing it under the GNU Public License. In particular, you can't distribute it, or any modified version of it that you produce, without giving other people the option of getting the complete corresponding source code.
Secondly, xphat is a program that provides the functionality associated with MIDI slider/fader boxes such as the Peavey PC-1600 and the Phat Boy. Its a device for controlling other MIDI devices that respond to MIDI messages in useful ways. Such devices could include external MIDI synthesizers, soundcard-based synthesizers that can be controlled via MIDI, MIDI effects processors, MIDI software tools, software sequencers such as Rebirth or Softwerk; basically, any MIDI device.
xphat grew out of my frustration with conventional computer-based device simulations, which rely on the mouse for action and/or use conventional event processing. These approaches typically restrict you to modifying only one thing at a time. It seemed to me that a computer keyboard, although not the ideal control device for every purpose, had on the order of 100 keys that could be used as controls for a device like xphat. I think that xphat is novel in its use of the computer keyboard as a controlling device allowing simultaneous manipulation of several objects at once.
You will need:
Once you've collected all the pieces, then:
xphat displays 1 or more windows each of which contains 16 sliders. These sliders can be controlled with the mouse, or, more usefully, with the keyboard. Each slider can be bound to a keyboard key. The response of each slider to a keypress is by default logarithmic (the slider moves quicker the longer you press "it"), but each slider can be given a custom response curve using a simple graphical curve drawing tool. The space bar gives a convenient method of reversing the direction of slider movement.
Each slider can emit any MIDI message (except Active Sense). Most of the modes for each slider feature a well-defined MIDI message type (such as Note On, Controller N, Pitch Bend, etc.) which contain one parameter which can be varied by moving the slider. One exception to this is "Sysex" mode, which allows a slider to be programmed with an arbitary sequence of bytes, including parameters that can be altered.
The following command line options are available:
Arbitrary Sysex Messages (either custom or defined in the sysex configuration file can contain a number of special references that provide for dynamic adjustment of the message sent by that slider. Each reference is inserted into the message as a single character, and must be one of the following:
xphat uses a simple text file to provide the information necessary to predefine useful System Exclusive messages for a variety of MIDI devices. The file can be specified on the command line with the -s or --sysex options. If unspecified, xphat looks for a file called "xphat.sysex" in the current directory.
This file has a very simple format:
An example will help:
#----------------------------------------------------------------------- # # Sysex Info File for xphat # Oberheim Matrix 6 keyboard mode = f0 10 06 06 30 P f7 dco1 freq = f0 10 06 06 00 P f7 dco1 saw shape = f0 10 06 06 05 P f7 dco1 pulse width = f0 10 06 06 03 P f7 dco1 mod/vibrato = f0 10 06 06 07 P f7 dco1 waveform = f0 10 06 06 06 P f7 #-----------------------------------------------------------------------
The System Exclusive message is specified in a series of two-character sequences, each of which is a hexadecimal value. They may also contain the parameter references "P" or "V" (see Parameters above for details on how these work.
The Port selector pops up a menu of available MIDI ports to assign as this sliders output MIDI port.
The Channel selector has two modes: clicking on it with the right button will advance through the available MIDI channels; clicking with the left will pop up a list of channel choices.
The Button can function in many different ways. Its mode can be set by editing the slider. Possible modes are:
The slider is just that - a slider. It may be moved by pressing the key bound to that slider (displayed in the Key Window), or using the mouse. If the slider is part of a group, moving any slider in the group (with the mouse or with the keyboard) will move all other sliders in the group. The slider will also move if it has been set to use MIDI input for update, and relevant MIDI messages are received on its input port.
The Value window displays the value of the current slider. This is the value that will be inserted into the message sent by this slider. It can also be directly edited by first clicking on it, typing in a new value, and then pressing the TAB or Return keys.
The Mode button, when pressed, pops up a list of available modes for this slider, and displays a description of the mode once selected. See Slider Modes for details on each mode.
The Key selector allows to specify the key that will control this slider. Click on the key selector, press the key you want to use, and then press TAB or Return. NOTE: at present, only alpha-numeric keys can be used for binding to a slider. A future version may alter this.
The Group selector allows you to assign the slider to a group, and optionally, for certain slider modes, a particular MIDI note value within that group. Sliders in a group can be all be simultaneously controlled by adjusting any of the group's member sliders.
Click on the group selector, then edit its contents. If you just want to specify the group, use a simple integer. To specify a group and a note number, separate them with a period (e.g. 3.64 means "group 3, MIDI note number 64). You can also use 0 for the group, which means "no group". Once you've entered the desired value, press TAB or RETURN. This and any other sliders with the same group ID are then all considered to be part of a group.
Notice that the Group selector allows great control when used with the On Velocity or Off Velocity modes. If the slider is assigned to a MIDI note number, the slider will only edit the velocity values of the specified note. This can be used as a powerful means of fading parts of a track, especially drumkits, where typically a given MIDI note corresponds to a particular drum sound. By collecting several MIDI notes together into the same group, you can fade in/out entire sections of a drumkit (or other pattern-based musical form).
The Preset button pops up an interface for saving, naming, renaming and loading presets. See Preset Handling.
The Thru Mode button turns on/off MIDI thru mode. When turned on (pressed), each MIDI port used by xphat is connected to the next port (where next is defined by the order they were opened in, and where the last port is connected to the first, to form a closed circle). Thru mode is shared by all windows created by xphat (i.e. it is a global property of the program).
The More Sliders button creates a new window of 16 sliders and their controls. This new window is completely independent of all others xphat creates, and has its own keybindings, preset storage, and so on. The only setting it shares with other windows is the "Thru mode".
The Quit button closes the window it is on, and, if this is the last window that xphat has created, exits from xphat.
There's no documentation for this yet. But ... try pressing the control key and one of the keys bound to a slider (mnemonic: "control slider K"), and see what pops up. It should be fairly obvious. Don't try editing the response curve yet, its still broken. Also, the SysEx mode selector doesn't do anything useful.
One big problem you may notice is that if you try to operate two sliders at the same time using the keyboard, it doesn't always work. I've spent a lot of time investigating this issue, and it turns out to be very deeply rooted in the hardware of the PC keyboard. There is an electrical contact matrix under the keyboard, which is used to identify which keys are depressed. In certain keyboard designs, the matrix doesn't always allow the correct identification of simultaneous "key held down" conditions for arbitary combinations of keys. For example, on my keyboard, once 't' is held down, no keyboard interrupt for 'r', 'y', or 'u' will be generated until 't' is let up and those keys pressed again. xphat is not the only program to encounter this: you can see the same behaviour with the X event testing program xev(1), and a Linux console keyboard utility (whose name I forget). The best approach to this is to rebind the slider to a key in a different section of the keyboard, although this is a trial-and-error approach, since you can't predict which keys suffer from this problem.