MouseInputSource pressure on iOS devices


#1

Does the MouseInputSource pick up touch pressure on iOS devices? No matter how hard/soft I tap my iPad, the value of “pressure” is always 0. I know my iPad has 3D Touch, as I’m able to use velocity in other music apps, like Garageband.


#2

Any thoughts on this?


#3

So I’m guessing that’s a no. Are there plans to support 3D touch? I’d like to make my iOS synth keys velocity-sensitive to touch.


#4

We do pick up the pressure:

No idea why it wouldn’t get set on your device but you could debug that function and see what’s happening in there.


#5

When Apple introduced this feature in GarageBand, they used the accelerometer of the device to figure out the touch pressure, as the display sensor itself was not able to do this. Nowadays I think they use the pressure sensor in the display (they named it forced touch I think?) to do this. Are you sure your device has this sensor in it?


#6

You’re right. I assumed my device had it since it worked in GB but after digging deeper, apparently Apple has never put 3D Touch into the iPad, only the iPhone.

Along with the accelerometer, I’ve come across a couple other techniques:

  1. Measuring the touch radius, since the harder you press, the more of your finger tip smushes against the screen

  2. Using the mic. The harder the tap, the louder the impact. Though, I imagine this technique would be problematic in a noisy environment.

Time to experiment.


#7

I put together an implementation with room for improvement and posted it at iOS MidiKeyboard Touch Velocity (New thread since this one is more about 3D Touch and Pressure).