Xbox 360 Controller Question

Daniel Wenger's icon

I have an Xbox 360 controller working effectively in Max.

A minor issue, however, is that the joysticks sputter when centered. Their range is -32767 to 32767. When centered, they sputter +/- 100-800.

One simple solution is to deaden the resolution with a scale object (scale 0-200).

I am curious about other solutions--particularly something that addresses the sputter without loss of resolution.

Also, the joystick's center is never dead center. When scaled 0-200, for instance, one joystick at center outputs 104, the other 98. Is there a method for calibrating /centering the joystick?

Thank you for any thoughts, insights and/or guidance.

Dan

Rodrigo's icon

I've had the same exact problem. This is my solution. (I scale the -32k to 32k to 0. to 1., so the input to this is in that range (0. to 1.)) (edit: looks like I've made that editable, although I only use it in 0. to 1. range):

This makes a "deadzone" similar to how it works in a real xbox, what this abstraction also does is maps 'around' the deadzone so that even though there's a bit of area you are losing in terms of input resolution, you don't actually lose anything in terms of output resolution, if that makes sense.

Max Patch
Copy patch and select New From Clipboard in Max.

Daniel Wenger's icon

Very cool. I just downloaded this, and I will need to study it tonight.

Thank you so much for sharing!

Dan

Rodrigo's icon

You might also appreciate this too.

Connect this to your [hi] object:

Max Patch
Copy patch and select New From Clipboard in Max.

Then open the following file (make sure the xbox.png file is in the same folder with the .maxpat, along with the abstraction I posted above, named as [deadzone]).

(if you're curious I've done a bunch of work mapping Xbox 360 controller stuff in Max. Here's a big (free) bit of software I wrote, along with a long-ass blog about the approach/motivations/background/etc...:
http://www.rodrigoconstanzo.com/2015/06/cut-glove/)

xbox.png
png
xbox_display7.maxpat
Max Patch
Daniel Wenger's icon

Thank you, Rodrigo.

I enjoyed the range of interesting work you and your partner are doing.

Since we are on the topic of controllers, I wonder your thoughts on the trackpad on the PS4 wireless controller.

This is a great controller. But Max does not seem to see the trackpad. Everything else--joysticks, buttons etc. are visible.

Any thoughts on that?

Again, thank you for so openly sharing what you know.

Dan

Rodrigo's icon

Thanks!

I've not used one of the PS4 controllers, but have been curious. Same goes for the Steam controller, which also has a touch-y interface. Interesting that it doesn't show up at all in Max. I guess the touch part doesn't go down the human interface pipeline.

Perhaps there are alternate drivers or something that expose that part, or let you remap it to something else?

Daniel Wenger's icon

I'll play with it.

Still working with deadzone patch. I am re-scaling the output of the joystick to 0. 1.0.

But not sure what parts of the patch to modify to establish deadzone.

Dan

Rodrigo's icon

As long as you use that bit of code I posted above, it should work perfectly. In fact the deadzone abstraction is built into the bit of code I pasted, so it should already be incorporated if you use that.

The deadzone abstraction will let you modify how much deadzone to have, but the default value works perfectly for my tastes (sensitive enough, but always returns to the middle even if you flick the analog pads around).

Greg Araya's icon

@Rodrigo, are you still out there? I have a wired 360 controller and got your original patcher working in Catalina and the 1.0.0-alpha.5 driver with a few caveats: The routes need to range from 12 to 32, and the positive/negative scales need to be inverted for routes 30 and 32 (the Y axis for the analog sticks.)

I am planning to set this up with UDPsend to make this an OSC controller, and do not expect any issues there. Thanks for all your work and generosity in sharing this!

I was also able to set this up with the deadzone patch, but I don't quite understand how the settings work. I am using the default settings, but there is no inhibiting of values being sent. It is the same as if I were using the original patcher. How might I troubleshoot this?