Transform your Apple Trackpad into a midi device (only Linux)
- Linux
- Apple TrackPad
- evdev —
sudo apt install libevdev-dev - portmidi —
sudo apt install libportmidi-dev
git clone <this repo>
cd <this repo>
cmake -S . -B build
cmake --build build
./build/apps/miditrackpad # <--- executable here
- Run the executable (NB. requires root privileges, eg. sudo)
- Touch the trackpad (emits MIDI messages)
By default, the device axes emit standard MIDI keyboard actions
- X-Axis ⇒ (PB) Pitch Bend (after touch release, it resets to center)
- Y-Axis ⇒ (CC1) Control Change #1 (Modulation)
- Z-Axis ⇒ (CP) Channel Pressure (Aftertouch)
However, each axis may assign to any of the afforementioned MIDI actions (including none), and may optionally reset to center, after release.
Command line flags
./miditrackpad
-l # list all evdev input and midi output devices
-t <timeout-ms> # how long poll() should wait
-i <evdev-input-device-id|device-path>
-o <midi-output-device-id>
-c <midi-channel> # [1-16]
-x <PB|CC#|CP|OFF>[!] # configure MIDI actions on this axis
-y <PB|CC#|CP|OFF>[!] #
-z <PB|CC#|CP|OFF>[!] #
Examples:
# list all input and output devices
./miditrackpad -l
# translate events
# from input device 1
# to output device 2
# on MIDI channel 3
./miditrackpad -i /dev/input/event1 -o2 -c3
# or equivalently
./miditrackpad -i1 -o2 -c3
# or with custom axis assignment
# where:
# x-axis emits Control Change 88, and resets to center
# y-axis emits Control Change 89, and does NOT reset to center
# z-axis emits Pitch Bend, and resets to center
./miditrackpad -i1 -o2 -c3 -xCC88! -yCC89 -zPB!