Setting up a joystick

concept_control

2008-11-05 13:50:09

Hey guys, I'm struggling with getting my joystick set up the way I want it inside MT, it's the ALPS branded one from PS2 controllers -

At the moment, it sends out 2 CCs from 0-127 on both it's axes, and it's centre is 64, bottom left is 0-0 (it's sprung to centre though) It's got a click-in function too that sends out a separate momentary CC @ 127.

What I'd ideally like is for the joystick to transmit;

UP - a CC, range 0-127,
DOWN- another CC, range 64-127,
LEFT and RIGHT - pitch bend - and + respectively.

With the button, I'd like to be able to click-to-toggle LEFT and RIGHT to become 2 separate CCs ranged 0-127, and click-to-toggle back to pitch bend.

I've just downloaded the MT Pro demo, as I was using the regular version, but just can't get my head around the new codes and rules used!

Thanks for any help you can offer,
Joe P

concept_control

2008-11-05 17:40:55

This was meant to be posted in the MT General Discussion, not the MK - could a mod shift it for me?

Sorry!

florian

2008-11-24 16:23:56

hi, sorry for the late reply.

Indeed, for such "custom" mappings, you need the rules from MT Pro.

1) UP - CC, range 0-127
You will need to check the value. If it's larger or equal than 64, scale it and send it out.

Name: UP
INCOMING: MIDI IN: B0 45 pp
RULES:
if pp < 64 then exit rules, skip Outgoing Action
pp = pp - 64
pp = pp * 2
if pp=126 then pp=127
OUTGOING: MIDI OUT: B0 45 pp

2) DOWN: other CC (46hex) , range 64-127
INCOMING: MIDI IN: B0 45 pp
RULES:
if pp >= 64 then exit rules, skip Outgoing Action
pp = pp + 64
OUTGOING: MIDI OUT: B0 46 pp

3) LEFT/RIGHT: pitch bend (say on controller 47hex)
INCOMING: MIDI B0 47 pp
RULES:
pp = pp * 16383
pp = pp / 127
qq = pp & 127
rr = pp / 128
Outgoing: MIDI E0 qq rr

4) button
I'm not sure how that can be done. Does it send a different CC than up/down and left/right? Does it send value 127 when pressing down, and another value when releasing?

Let me know how it works.
Florian

concept_control

2008-11-24 20:21:14

Hey, first off thanks so much for the detailed help! Very kind of you indeed :)

The button is wired separately to the joystick, and emits a different CC to the joystick's axes, it's a momentary one, and wired so it sends 0 when left alone, and 127 when clicked down.

Cheers,
Joe

florian

2008-11-25 11:24:49

OK, so then you can add a translator to toggle the global variable ga from 0 to 1 and vice versa whenever you press the button (assuming it sends on CC 48hex ):

Code: Select all

INCOMING: B0 48 7F
RULES:
 ga=1-ga
OUTGOING: <none>
Now adapt the pitch bend translator from 3) to not do anything if ga is set:

Code: Select all

INCOMING: MIDI B0 47 pp
RULES:
if ga=1 then exit rules, skip outgoing action
pp = pp * 16383
pp = pp / 127
qq = pp & 127
rr = pp / 128
Outgoing: MIDI E0 qq rr
Last but not least, add another translator for the case that the toggle is ON:

Code: Select all

Left send on CC 49hex, right on CC 4Ahex
INCOMING: MIDI B0 47 pp
RULES:
 if ga=0 then exit rules, skip outgoing action
 pp=pp*2
 if pp>=128 Goto "right"
 Label "left"
 qq=0x49
 exit rules, execute outgoing action
 Label "right"
 pp=pp-128
 if pp=126 then pp=127
 qq=0x4A
Outgoing: MIDI B0 qq pp
Hope that works!
Florian

concept_control

2008-11-25 19:43:18

Thanks again!

I'm not able to test the codes yet but I just read through them thoroughly and think I'm starting to get to grips with the program, however I think spotted a problem -

Untranslated, going down and left from centre sends 64 to 0 on the joystick's two CCs, rather than 0 - 64, It looks like the rules will make the joystick work inwards, rather than outwards, with the DOWN, the PB -, and CC toggle rules. If it isn't too much, could you lend a hand switching them round?

Finally, for the CC rule, where you type qq=0x4A, it results in a rule qq=73, is that OK?

Really sorry to be a pain!

concept_control

2008-11-30 13:45:02

Hey, had a tinker myself -

This one theoretically (still haven't found a breadboard to test :( ) makes the down command work from centre outwards

Code: Select all

DOWN HOPEFULLY FIXED: other CC (46hex) 
INCOMING: MIDI IN: B0 46 pp 
RULES: 
if pp >= 64 then exit rules, skip Outgoing Action 
pp = 64 - pp 
pp = pp * 2
if pp=126 then pp=127
OUTGOING: MIDI OUT: B0 46 pp
And the same with the L / R CCs, however I'm not sure about the QQ parts

Code: Select all

Left FIXED send on CC 49hex, right on CC 4Ahex 
INCOMING: MIDI B0 47 pp 
RULES: 
 if ga=0 then exit rules, skip outgoing action 
 pp=pp*2 
 if pp>=128 Goto "right" 
 Label "left" 
pp= 127-pp
 qq=0x49 
 exit rules, execute outgoing action 
 Label "right" 
 pp=pp-128 
 if pp=126 then pp=127 
 qq=0x4A 
Outgoing: MIDI B0 qq pp
However, I can't get my head around the pitch bend one! I don't know if it needs modifying because I don't get the way the qq, rr and & work to make the pb message.

Cheers,
Joe

florian

2008-12-12 10:06:44

Finally, for the CC rule, where you type qq=0x4A, it results in a rule qq=73, is that OK?
Yes. The rules are shown in decimal, while prepending 0x is hexadecimal notation.

Have you tested the setup? I thought I had the direction right, if it doesn't work with pitch bend, let me know and I give it a try...

Florian