Dualshock 4 Input

Hi all. Some time ago I was fiddling with John Woo Park's Dualshock-to-Supercollider work and ended up with a supercollider snippet to send that data to Tidal. It's been a while, no idea if it still works, but I remember having fun with it.
Word of advice: sending /ctrl to tidal means some response latency depending on your setup. If you just want to control external synth params, routing it directly via SC seems best.

s.waitForBoot {
    ~tidalctrl = NetAddr.new("localhost", 6010);
    
    // Connect Dualshock
    HID.findAvailable;
    if (HID.findBy(1356, 2508).size > 0, {
		~dualshock = HID.open(1356, 2508);

		// Send DualShock input to Tidal
		~senddskey = { |...args|
			~keyname = args[0];
			
			// (~keyname + " " + args[2]).postln;
			~tidalctrl.sendMsg("/ctrl", ~keyname, args[2]);
		};

		// Forward Dualshock Input to appropriate inputs
		~dskey = { |n, keyname| HIDFunc.element({ |...args| ~senddskey.value(keyname, *args)}, [n]); };

		~dskey.value(0,"joylx");
		~dskey.value(1,"joyly");
		~dskey.value(2,"joyrx");
		~dskey.value(3,"joyry");

		~dskey.value(4,"triangle");
		~dskey.value(5,"square");
		~dskey.value(6,"cross");
		~dskey.value(7,"circle");
	});
}
1 Like

Thanks for the post!

I'm going off on a tangent here, but since you brought up Joo Woo Park... I had to mention that I have often been inspired by his creations - they are inventive, fun, spontaneous, and use technology creatively. I'm not aware if he has done any actual livecoding, but he does a lot with live electronics and live sampling that seems (to me at least) to capture the spirit of some types of livecoding through improvisation.

Here is a session that uses live improvisation with a collection of every day objects:

A similar one: Joo Won Park - Touch - YouTube

-- Sorry this is nothing to do with your post about Dualshock.

1 Like