Skip to content

Instantly share code, notes, and snippets.

@gregtemp
Created April 8, 2015 18:15
Show Gist options
  • Save gregtemp/16b97db169a7ef0092c9 to your computer and use it in GitHub Desktop.
Save gregtemp/16b97db169a7ef0092c9 to your computer and use it in GitHub Desktop.
A little sketch that allows you to use the trackpad on a mac as a midi controller. Turn on "Enable mouse keys w/ option/alt key". Press left alt key 5 times to switch between using trackpad as mouse or midi controller. Messages on the right are used to map x and y separately.
#N canvas 320 145 457 391 10;
#X declare -lib sfruit;
#X obj 39 81 multitouch;
#X obj 39 41 tgl 15 0 empty empty empty 0 -6 0 10 -204786 -1 -1 0 1
;
#X obj 39 60 metro 20;
#X obj 39 295 print;
#X obj 39 103 unpack 0 0 0 0 0 0 0;
#X obj 39 129 + 120;
#X obj 84 128 * 127;
#X obj 127 127 * 127;
#X obj 39 206 pack f f;
#X obj 99 183 - 10;
#X obj 99 206 pack f f;
#X obj 84 150 int;
#X obj 127 148 int;
#X msg 39 239 \$1 \$2 2;
#X msg 99 239 \$1 \$2 2;
#X msg 214 149 127 120 2;
#X obj 99 297 ctlout;
#X text 288 149 1 fing x;
#X msg 214 169 127 110 2;
#X text 288 169 1 fing y;
#X text 298 195 2 fing x;
#X text 298 215 2 fing y;
#X msg 224 195 127 121 2;
#X msg 224 215 127 111 2;
#X msg 236 241 127 122 2;
#X msg 236 261 127 112 2;
#X text 310 241 3 fing x;
#X text 310 261 3 fing y;
#X obj 115 267 r midiMap;
#X obj 214 289 s midiMap;
#N canvas 540 240 215 248 mouseKeys 0;
#X obj 60 52 delay 500;
#X obj 45 27 keynamedown Alt_L;
#X obj 69 75 b;
#X obj 45 125 sel 4;
#X obj 45 99 counter 4;
#X obj 46 172 import sfruit;
#X obj 45 148 outlet;
#X connect 0 0 2 0;
#X connect 1 0 0 0;
#X connect 1 0 4 0;
#X connect 2 0 4 2;
#X connect 3 0 6 0;
#X connect 4 0 3 0;
#X restore 39 18 pd mouseKeys;
#X connect 0 0 4 0;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 4 0 5 0;
#X connect 4 5 6 0;
#X connect 4 6 7 0;
#X connect 5 0 8 0;
#X connect 5 0 9 0;
#X connect 6 0 11 0;
#X connect 7 0 12 0;
#X connect 8 0 13 0;
#X connect 9 0 10 0;
#X connect 10 0 14 0;
#X connect 11 0 8 1;
#X connect 12 0 10 1;
#X connect 13 0 3 0;
#X connect 13 0 16 0;
#X connect 14 0 3 0;
#X connect 14 0 16 0;
#X connect 15 0 29 0;
#X connect 18 0 29 0;
#X connect 22 0 29 0;
#X connect 23 0 29 0;
#X connect 24 0 29 0;
#X connect 25 0 29 0;
#X connect 28 0 16 0;
#X connect 30 0 1 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment