Pd external and Pd-Lua object to connect and display Sony DualSense controller
supports multitouch pad inputs, gyro and accelerometer sensors, force feedback and LED control with USB and Bluetooth connection
- extract
dualsensefrom latest release into on of your Pd externals folders - add
dualsenseto your paths or add[declare -path dualsense]to your patch - create
[dslink]object (its output can be connected to the[dsshow]object) - send
open, poll 10message to connect to controller and poll data in 10ms intervals - additionally, you can place
[sensors2quat]and[sensors2impulse]between the second (IMU) outlet of [dslink] and [dsshow] to also display orientation and movement impulses - obviously, the main purpose is that all messages can be used to control arbitrary patch parameters
- requires
pdluaexternal for display (available through deken)
-1will suppress the automatic connection attemps
| selector | atom[0] | values | description |
|---|---|---|---|
| led | color | <r> <g> <b> <brightness> |
|
| mute | 1 / 0 |
turn "mute" LED on or of | |
| players | 0..31 |
control "players" LEDs | |
| brightness | 1 / 0 |
change brightness of "mute" and "players" | |
| motor | left | 0..255 |
change intensity of actuators |
| right | |||
| trigger | left | list of bytes |
control trigger mode and settings |
| right | |||
| configure | <byte> |
currently exposes some bits for LED and motor modes. handle with care |
also see screenshot, help and code ... more documentation will follow!
interaction with controller elements:
| selector | atom[0] | atom[1] | values | description |
|---|---|---|---|---|
| analog | l | x | -1..1 |
left analog stick position |
| y | ||||
| r | x | -1..1 |
right analog stick position | |
| y | ||||
| digital | x | -1 / 0 / 1 |
digital pad directions | |
| y | ||||
| trigger | l | 0..1 |
trigger position | |
| r | ||||
| button | triangle | 1 / 0 |
pressed state | |
| circle | ||||
| cross | ||||
| circle | ||||
| square | ||||
| l1 | ||||
| r1 | ||||
| l2 | digital triggers state | |||
| r2 | ||||
| l3 | analog sticks pressed | |||
| r3 | ||||
| pad | touchpad press | |||
| create | additional buttons | |||
| options | ||||
| ps | ||||
| mute | ||||
| pad | touch1 | active | 1 / 0 |
if first touch is detected |
| x | 0..1 |
touch position | ||
| y | ||||
| touch2 | active | 0 / 1 |
if second touch is detected | |
| x | 0..1 |
touch position | ||
| y |
orientation interaction:
| selector | atom[0] | values | description |
|---|---|---|---|
| gyro | x | <float> |
rotational velocity |
| y | |||
| z | |||
| accel | x | <float> |
acceleration (seems to be normalized to 1 for earth gravity) |
| y | |||
| z |
status information (probably not fully functional yet):
| selector | atom[0] | values | description |
|---|---|---|---|
| battery | level | 0..9 |
battery level (need to recheck scale) |
| status | 0 |
discharching | |
1 |
charging | ||
2 |
full | ||
3 |
temperature high (should be its own message) | ||
4 |
temperature low | ||
| bluetooth | 1 / 0 |
1 if connected via Bluetooth | |
| headphones | 1 / 0 |
1 if headphones connected | |
| microphone | 1 / 0 |
1 if microphone connected | |
| haptic active | 1 / 0 |
(need to check - probably not working) |
- currently only tested on MacOS 15 (arm64) and Win11
- Windows version doesn't support motor and LED control yet
- needs more documentation (mainly all possible message input for dsshow)
- some more features and fixes (also see issues)
