Zynps4 — Use a PS4 🎮 (DualShock 4) controller as a Zynthian MIDI + UI controller

Hey everyone! :waving_hand:
I’d like to share a small (but super fun) project I’ve been working on called Zynps4.

Zynps4 turns a PlayStation 4 controller (DualShock 4) connected to a Raspberry Pi running Zynthian into a MIDI controller. It can emit MIDI Notes / CC / Pitch Bend over JACK, and it can also send Zynthian CUIA commands over OSC, so you can play instruments and drive the Zynthian UI from the same controller.

Quick disclaimer (vibecode / AI-assisted)

This project was written using a vibecode / AI-assisted workflow.
That means: it works, it’s structured, but I’m also very aware there may be rough edges, missing best practices, or better ways to do certain parts. I’m sharing it openly because I’d love feedback, suggestions, and improvements from people who really know Zynthian/Linux/JACK/MIDI/HID details.

What it does (high-level)

  • Reads the DualShock 4 input via HIDAPI and converts raw reports into events:
    • buttons, axes, touchpad
  • Loads a config (one of 4 modes) and maps controller events into actions:
    • MIDI (Note / CC / Pitch Bend) over JACK
    • CUIA commands over OSC UDP to Zynthian (port 1370)
  • Lets you switch modes live:
    • Hold PS + press DPAD direction
      • Up → config1 (Mode 1, blue LED)
      • Right → config2 (Mode 2, red LED)
      • Down → config3 (Mode 3, green LED)
      • Left → config4 (Mode 4, yellow LED)

Why I built it

I love the Zynthian ecosystem, but for my live setup I wanted something faster + more tactile than touch navigation and more “muscle-memory friendly” than many MIDI controllers for UI navigation. I already had tons of experience with game controllers… so I went all in on using the DS4 as a “one device controls everything” solution.

What I’d love help with / suggestions welcome :heart:

If anyone here is willing to share advice, I’d really appreciate feedback on:

  • Best practices for JACK MIDI port registration on Zynthian
  • Improving config ergonomics (validation, comments, friendlier errors, generator tool)
  • Adding Bluetooth DS4 report support (USB works, BT differs)
  • Expanding CUIA mapping ideas / good default “UI navigation” layouts
  • New action types (Program Change, MIDI clock, etc.)
  • Any performance / stability improvements (latency, reconnect, edge cases)

If this sounds useful to you and you’d like to test it, critique it, or contribute ideas, please jump in. Even small suggestions (naming, structure, missing CUIA commands, better defaults) are super welcome.

2 Likes

CUIA sits at the root of pretty much everything you would want to do so it becomes an exercise in how to use your device to control the zynthian GUI.

The basic 4 encoders would require mapping and the select buttons, and presumably you’d have to come in and out of the facilities you have instilled?

How would you do a setup menu and where within the zynth would you expect to run it?

OH and welcome aboard and all that… I expect you have a rough idea of how all this works around here. Have considerably less soup for your excellent efforts!