I use a fairly unique keyboard
as my primary playing surface because I love its ability to help me see patterns in music. Unfortunately the KB doesn't have pitch bend, modwheel, aftertouch, or any CC controllers.
For a while now I've been using a cheap 25 key keyboard
along with the Axis just for the PB/MW and 16 rotary encoders. This wasn't ideal because the Xboard is much larger than the Axis and hindered my musical portability.
Two days ago I was at Fry's electronics
and saw this little controller
for $15. I remembered seeing Reaper 3 had joystick support so I figured I'd give it a go...
Two days layer I have a very usable, small, inexpensive controller I place next to my Axis and I get all the expression I need.
>>> DOWNLOAD GAMEPAD SCRIPT HERE <<<
1. Download the file, unzip it and place gamepad_expression.txt into (REAPER ROOT)\joystick_midi
2. Load Reaper with your joystick connected and go to Options -> Preferences... (Ctrl+P)
3. Select in the left hand frame Audio->MIDI Devices then click on the button [ Add Joystick MIDI... ] on the right hand side of the box in the middle.
4. In the popup dialog box titled "Joystick->MIDI" select your joystick in the Device: pulldown, then select "gamepad_expression.txt" in the "Processing Script:" pulldown. You can optionally select what midi channel you want messages sent on via the "Script mode:" pulldown.
At this point you should be ready to go! If you move the analog sticks you should see numbers changing on the "axis=" line in the Joystick->MIDI box. If you don't there might be a problem with Windows seeing your joystick.
How the script configures the joystick:
Since I'm a lefty (sorry!) I configured this script to place the joystick on the right
side of my keyboard in the following way:
Please note the directions I use in the instructions below are in relation to this diagram! UP in the directions is normally "left" when holding the joystick if you were playing a game with it.
The script has 10 joystick presets and starts at preset 1 by default. The different presets only change how the analog joysticks work, the buttons and D-PAD (POV) are always the same. The presets configure the gamepad in the following way:
Joy 0 up = pitchbend up
Joy 0 dn = pitchbend down
Joy 1 up = modwheel 0-127
Joy 1 dn = aftertouch (channel pressure) 0-127
Joy 0 is now an XY controller with two CCs mapped to the XY axis. When centered the CCs transmit 63 for both. This is great for synths like Zebra and Alchemy that have XY expression controllers.
Joy 1 up is the same as Joy 0's X-axis.
Joy 1 down is the same as Joy 0's Y-axis.
The CCs for presets 2-10 go from 102 to 119 with even CCs being the Y-axis and odd CCs being the X-axis.
This is useful as some people map 0,0 to be the default sound and others map 63,63 as the default.
Buttons 1-4 can be used to quickly change to any of the 10 joystick presets. Subsequent button presses are added up until the same button is pressed twice. That value is then used to switch to that preset. The second button preset is not summed with the value.
It sounds a bit weird but is really simple once you start using it.
switch to preset 1: 1, 1
switch to preset 2: 2, 2
switch to preset 3: 2, 1, 1 or 3, 3
switch to preset 4: 4, 4 or 3, 1, 1
switch to preset 10: 3, 2, 3, 2, 2 (one of many)
Button 5 switches the D-PAD (POV) from joystick preset mode to midi preset mode (more on this when I talk about the D-pad). This is a momentary button, you have to hold down button 5 to keep the pad in midi mode. As soon as it's released the pad goes back into joystick preset mode.
Button 6 (bottom shoulder button, closest to top) is akin to a panic reset. It puts the joystick back in preset 1, sends all notes off, and resets pitchbend, modwheel, and channel pressure. It also resets your midi bank select to 0, 0, 0. So use this button with care!
The bottom shoulder buttons (7,8) and the joystick depression buttons (11, 12) are unmapped. I may think of something for 7,8 in the future but I find 11 and 12 are just too hard to use w/o causing the joystick to wiggle.
Buttons 9 and 10 (in the select and start spots in PS2/PS3 controller configs) are the freeze/unfreeze buttons for each joystick.
Button 9 works as you expect. Move Joystick 0, press button 9, and the pitchbend/midi CC doesn't change if you keep moving it. Press button 9 again and you can move the joystick again.
Button 10 works a bit differently. It only freezes the active direction. This is really useful if you want to freeze the modwheel position (up) and then adjust channel pressure (down). Centering the joystick and pressing button 10 will unfreeze it.
The D-Pad (aka POV)
When button 5 is not depressed (see above) the D-Pad operates as follows:
UP = unfreezes and resets Joy 0's parameters
DN = unfreezes and resets Joy 1's parameters
LEFT = selects the previous joystick preset (wraps around at 0 back to 10)
RIGHT = selects the next joystick preset (wraps around at 10 back to 0).
When Button 5 is held down the pad changes to sending MIDI bank select messages:
UP = the previous BANK (note this wraps at 0 to very large bank configs (MSB 127, LSB 127, PC 127). If you're not at the beginning of a bank, it takes you back to the beginning of the current bank. If you are at the beginning of a bank then it will take you to the previous bank.
Example. You're on preset 260. You press 5+UP. You're now at preset 256. You press 5+UP. You're now at Preset 128. You press 5+UP. You're now at Preset 0.
DN = the next BANK (will wrap around to 0). This always goes to the next bank in the series.
Example. You're on preset 260. You press 5+DN. You're now at preset 384 (256+128). You press 5+DN. You're now at preset 512.
LEFT = the previous midi preset (wraps at 0)
RIGHT = the next midi preset (wraps at 2+ million -- 21 bits)
These joysticks are cheap, dirt cheap. This means they're not super-fine precision instruments. On my specific gamepad Joy 0 has a bigger dead spot for center than Joy 1 does. I'd imagine every joystick has slightly different dead spots.
The script initializes during init what are considered the dead spots for the positive and negative directions of the joystick. These can't be detected and have to be entered by the user.
In the Joystick->MIDI menu there is status about the joystick under the "Running:" title.
Look for the line like "axis=-0.008000 0.008000 0.000000 0.000000"
These are the current axis readings for your 4 joystick axes. If you see numbers like above that are non-zero when you're not touching the joystick you need to modify the following lines in the script:
// Axis thresholds are based on the particular joystick when it is centered
// but the read value isn't true zero. Any joystick value falling within this
// range will be treated as true zero.
// offset + 0 == the negative direction threshold
// offset + 1 == the positive direction threshold
mem[axis_thresh + (AXIS_IDX_0 * 2)] = -0.032;
mem[axis_thresh + (AXIS_IDX_0 * 2) + 1] = 0.001;
mem[axis_thresh + (AXIS_IDX_1 * 2)] = -0.047;
mem[axis_thresh + (AXIS_IDX_1 * 2) + 1] = 0.001;
mem[axis_thresh + (AXIS_IDX_2 * 2)] = -0.024;
mem[axis_thresh + (AXIS_IDX_2 * 2) + 1] = 0.001;
mem[axis_thresh + (AXIS_IDX_3 * 2)] = -0.001;
mem[axis_thresh + (AXIS_IDX_3 * 2) + 1] = 0.001;
These lines are important to get true zero readings for values, especially pitchbend.
I wanted to add these as options to the menu but I couldn't see how to get a different submode dialog box. For now you'll have to edit it by hand. Considering you get this for free I think that's a fair trade-off.
If something gets out of whack, just remember to press button 6 to reset everything.
If that doesn't work, the Joystick->MIDI menu for your gamepad has a [Reload Script] button on it. That will reset the script as well.
If anyone has any suggestions let me know. I couldn't get Reaper to see the up/down axis on joystick 1 for some reason (I submitted a bug) so for now that axis is unusable.
I hope someone out there finds this useful. I sure as heck do, it's made playing my softsynths a ton more fun!
A biiiiiig thanks to the Reaper devs for adding joystick support + scripting!!
I've added a second script to use the Saitek P3200. It required a few tweaks because the axes are enumerated differently. I also updated the P3200's reset button to require hitting LB then RB. I found I got less accidental resets this way.