├── .gitignore ├── README.md ├── chuck ├── clave.aif ├── hat.aif ├── kick.aif ├── osc.ck ├── pitft_sample.ck ├── pitft_sine.ck └── snare.aif ├── max ├── clave.aif ├── hat.aif ├── kick.aif ├── osc.maxpat ├── oscroute.js ├── pitft_sample.maxpat ├── pitft_sine.maxpat └── snare.aif ├── package.json ├── pd ├── clave.aif ├── hat.aif ├── kick.aif ├── osc.pd ├── pitft_sample.pd ├── pitft_sine.pd └── snare.aif ├── pitft ├── logo.png ├── package.json ├── sample.js └── sine.js ├── print.js ├── socketio.html └── socketio.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | *.swp 4 | *.swo 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node.js osc examples 2 | 3 | ## Installation 4 | 5 | The examples require the latest stable version of node.js (>= v0.12.0) to be installed. After downloading and installing node.js, you can clone this repository and install the dependencies using `npm`. 6 | ``` 7 | $ git clone https://github.com/toddtreece/osc-examples.git && cd osc-examples 8 | $ npm install 9 | ``` 10 | 11 | ### Cycling '74 Max 12 | 13 | If you would like to test the examples with Max, you will need to download and install the latest version of Max [from Cycling '74's website][1]. 14 | 15 | ### PureData 16 | 17 | If you are interested in the PureData examples, you will need to download and install the latest version of [Pd-Extended][2]. 18 | 19 | ### ChucK 20 | 21 | If you would like to use Chuck with the examples, you will need to download and install lastest version of the command line executable or miniAudicle from [Princeton's website][3]. 22 | 23 | ## Included Examples 24 | 25 | * `print.js` - prints received messages from the Max, Pd, or Chuck OSC examples. Also sends messages back one every second. 26 | * `socketio.js` - demonstrates communicating through OSC with a web browser in real time using socket.io and node.js to translate messages to and from Max, Pd, or Chuck. 27 | 28 | ### Raspberry Pi PiTFT Examples 29 | 30 | To demonstrate working with remotely connected hardware, there are a couple examples that make use of a Raspberry Pi and a [PiTFT touchscreen module][4]. 31 | 32 | 33 | #### Installation on a Raspberry Pi 34 | 35 | ``` 36 | $ git clone https://github.com/toddtreece/osc-examples.git 37 | $ cd osc-examples/pitft 38 | $ npm install 39 | ``` 40 | 41 | #### PiTFT Examples 42 | 43 | * `sine.js` - sends out X & Y of touches as MIDI pitch and velocity values. Top left of the screen is 0 pitch 0 velocty, and bottom right is 127 pitch & 127 velocity. Use with the pitft_sine example in Max, Pd, or Chuck on your workstation. 44 | * `sample.js` - creates a grid of 4 buttons that will trigger samples loaded with the pitft_sample example in Max, Pd, or Chuck on your workstation. 45 | 46 | 47 | [1]: https://cycling74.com/downloads 48 | [2]: https://puredata.info/downloads/pd-extended 49 | [3]: http://chuck.cs.princeton.edu/release 50 | [4]: https://www.adafruit.com/search?q=pitft 51 | -------------------------------------------------------------------------------- /chuck/clave.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/chuck/clave.aif -------------------------------------------------------------------------------- /chuck/hat.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/chuck/hat.aif -------------------------------------------------------------------------------- /chuck/kick.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/chuck/kick.aif -------------------------------------------------------------------------------- /chuck/osc.ck: -------------------------------------------------------------------------------- 1 | // SENDING 2 | OscOut xmit; 3 | xmit.dest( "127.0.0.1", 9998 ); 4 | xmit.start( "/print/chuck" ); 5 | "testing" => xmit.add; 6 | 5 => xmit.add; 7 | 32.93 => xmit.add; 8 | xmit.send(); 9 | 10 | xmit.start( "/socketio" ); 11 | 50 => xmit.add; 12 | 55 => xmit.add; 13 | xmit.send(); 14 | 15 | // RECEIVING 16 | OscIn oin; 17 | OscMsg msg; 18 | 9999 => oin.port; 19 | oin.addAddress( "/print/x, i" ); 20 | oin.addAddress( "/print/y, i" ); 21 | oin.addAddress( "/print/many, sfi" ); 22 | oin.addAddress( "/socketio, ii" ); 23 | 24 | while ( true ) 25 | { 26 | while(oin.recv(msg)) 27 | { 28 | chout <= msg.address <= " "; 29 | for(int n; n < msg.numArgs(); n++) 30 | { 31 | if(msg.typetag.charAt(n) == 'i') 32 | chout <= msg.getInt(n) <= " "; 33 | else if(msg.typetag.charAt(n) == 'f') 34 | chout <= msg.getFloat(n) <= " "; 35 | else if(msg.typetag.charAt(n) == 's') 36 | chout <= msg.getString(n) <= " "; 37 | } 38 | chout <= IO.nl(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /chuck/pitft_sample.ck: -------------------------------------------------------------------------------- 1 | me.dir() + "/kick.aif" => string kick_file; 2 | me.dir() + "/snare.aif" => string snare_file; 3 | me.dir() + "/hat.aif" => string hat_file; 4 | me.dir() + "/clave.aif" => string clave_file; 5 | 6 | SndBuf kick => dac; 7 | SndBuf snare => dac; 8 | SndBuf hat => dac; 9 | SndBuf clave => dac; 10 | 11 | kick_file => kick.read; 12 | snare_file => snare.read; 13 | hat_file => hat.read; 14 | clave_file => clave.read; 15 | 16 | // SENDING 17 | OscOut xmit; 18 | xmit.dest( "10.0.1.11", 9998 ); 19 | xmit.start( "/pitft/button" ); 20 | 1 => xmit.add; 21 | "kick.aif" => xmit.add; 22 | xmit.send(); 23 | xmit.start( "/pitft/button" ); 24 | 2 => xmit.add; 25 | "snare.aif" => xmit.add; 26 | xmit.send(); 27 | xmit.start( "/pitft/button" ); 28 | 3 => xmit.add; 29 | "hat.aif" => xmit.add; 30 | xmit.send(); 31 | xmit.start( "/pitft/button" ); 32 | 4 => xmit.add; 33 | "clave.aif" => xmit.add; 34 | xmit.send(); 35 | 36 | // RECEIVING 37 | OscIn oin; 38 | OscMsg msg; 39 | 9999 => oin.port; 40 | oin.addAddress( "/pitft/sample, i" ); 41 | 42 | while ( true ) 43 | { 44 | 45 | while(oin.recv(msg)) 46 | { 47 | 48 | if(msg.getInt(0) == 1) { 49 | 0 => kick.pos; 50 | kick.length() => now; 51 | } else if(msg.getInt(0) == 2) { 52 | 0 => snare.pos; 53 | snare.length() => now; 54 | } else if(msg.getInt(0) == 3) { 55 | 0 => hat.pos; 56 | hat.length() => now; 57 | } else if(msg.getInt(0) == 4) { 58 | 0 => clave.pos; 59 | clave.length() => now; 60 | } 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /chuck/pitft_sine.ck: -------------------------------------------------------------------------------- 1 | SinOsc s => dac; 2 | 1 => s.gain; 3 | 4 | // SENDING 5 | OscOut xmit; 6 | xmit.dest( "10.0.1.11", 9998 ); 7 | xmit.start( "/pitft" ); 8 | "connect" => xmit.add; 9 | xmit.send(); 10 | 11 | 12 | // RECEIVING 13 | OscIn oin; 14 | OscMsg msg; 15 | 9999 => oin.port; 16 | oin.addAddress( "/pitft/sine, ii" ); 17 | 18 | // infinite time-loop 19 | while( true ) 20 | { 21 | 22 | while(oin.recv(msg)) 23 | { 24 | msg.getInt(0) => Std.mtof => s.freq; 25 | msg.getInt(1) / 127.0 => s.gain; 26 | } 27 | 28 | 10::ms => now; 29 | } 30 | -------------------------------------------------------------------------------- /chuck/snare.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/chuck/snare.aif -------------------------------------------------------------------------------- /max/clave.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/max/clave.aif -------------------------------------------------------------------------------- /max/hat.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/max/hat.aif -------------------------------------------------------------------------------- /max/kick.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/max/kick.aif -------------------------------------------------------------------------------- /max/osc.maxpat: -------------------------------------------------------------------------------- 1 | { 2 | "patcher" : { 3 | "fileversion" : 1, 4 | "appversion" : { 5 | "major" : 7, 6 | "minor" : 0, 7 | "revision" : 2, 8 | "architecture" : "x86", 9 | "modernui" : 1 10 | } 11 | , 12 | "rect" : [ 380.0, 127.0, 755.0, 476.0 ], 13 | "bglocked" : 0, 14 | "openinpresentation" : 0, 15 | "default_fontsize" : 12.0, 16 | "default_fontface" : 0, 17 | "default_fontname" : "Arial", 18 | "gridonopen" : 1, 19 | "gridsize" : [ 15.0, 15.0 ], 20 | "gridsnaponopen" : 1, 21 | "objectsnaponopen" : 1, 22 | "statusbarvisible" : 2, 23 | "toolbarvisible" : 1, 24 | "lefttoolbarpinned" : 0, 25 | "toptoolbarpinned" : 0, 26 | "righttoolbarpinned" : 0, 27 | "bottomtoolbarpinned" : 0, 28 | "toolbars_unpinned_last_save" : 0, 29 | "tallnewobj" : 0, 30 | "boxanimatetime" : 200, 31 | "enablehscroll" : 1, 32 | "enablevscroll" : 1, 33 | "devicewidth" : 0.0, 34 | "description" : "", 35 | "digest" : "", 36 | "tags" : "", 37 | "style" : "", 38 | "subpatcher_template" : "", 39 | "boxes" : [ { 40 | "box" : { 41 | "fontname" : "Arial", 42 | "fontsize" : 13.0, 43 | "id" : "obj-26", 44 | "maxclass" : "message", 45 | "numinlets" : 2, 46 | "numoutlets" : 1, 47 | "outlettype" : [ "" ], 48 | "patching_rect" : [ 49.0, 158.0, 98.0, 23.0 ], 49 | "style" : "", 50 | "text" : "/socketio 40 44" 51 | } 52 | 53 | } 54 | , { 55 | "box" : { 56 | "id" : "obj-20", 57 | "maxclass" : "number", 58 | "numinlets" : 1, 59 | "numoutlets" : 2, 60 | "outlettype" : [ "", "bang" ], 61 | "parameter_enable" : 0, 62 | "patching_rect" : [ 306.5, 192.0, 50.0, 22.0 ], 63 | "style" : "" 64 | } 65 | 66 | } 67 | , { 68 | "box" : { 69 | "id" : "obj-19", 70 | "maxclass" : "number", 71 | "numinlets" : 1, 72 | "numoutlets" : 2, 73 | "outlettype" : [ "", "bang" ], 74 | "parameter_enable" : 0, 75 | "patching_rect" : [ 248.0, 192.0, 50.0, 22.0 ], 76 | "style" : "" 77 | } 78 | 79 | } 80 | , { 81 | "box" : { 82 | "id" : "obj-18", 83 | "maxclass" : "newobj", 84 | "numinlets" : 1, 85 | "numoutlets" : 2, 86 | "outlettype" : [ "int", "int" ], 87 | "patching_rect" : [ 248.0, 155.0, 69.0, 22.0 ], 88 | "style" : "", 89 | "text" : "unpack 0 0" 90 | } 91 | 92 | } 93 | , { 94 | "box" : { 95 | "id" : "obj-1", 96 | "maxclass" : "newobj", 97 | "numinlets" : 2, 98 | "numoutlets" : 2, 99 | "outlettype" : [ "", "" ], 100 | "patching_rect" : [ 248.0, 118.0, 131.0, 22.0 ], 101 | "saved_object_attributes" : { 102 | "filename" : "oscroute.js", 103 | "parameter_enable" : 0 104 | } 105 | , 106 | "style" : "", 107 | "text" : "js oscroute.js /socketio" 108 | } 109 | 110 | } 111 | , { 112 | "box" : { 113 | "id" : "obj-17", 114 | "linecount" : 3, 115 | "maxclass" : "comment", 116 | "numinlets" : 1, 117 | "numoutlets" : 0, 118 | "patching_rect" : [ 457.75, 392.0, 264.0, 47.0 ], 119 | "style" : "", 120 | "text" : "the oscroute.js helper script was created by James Drake and can be found here:\nhttp://monome.org/docs/app:oscroute" 121 | } 122 | 123 | } 124 | , { 125 | "box" : { 126 | "fontsize" : 16.0, 127 | "id" : "obj-16", 128 | "maxclass" : "comment", 129 | "numinlets" : 1, 130 | "numoutlets" : 0, 131 | "patching_rect" : [ 49.0, 32.0, 102.0, 24.0 ], 132 | "style" : "", 133 | "text" : "SEND" 134 | } 135 | 136 | } 137 | , { 138 | "box" : { 139 | "fontsize" : 16.0, 140 | "id" : "obj-15", 141 | "maxclass" : "comment", 142 | "numinlets" : 1, 143 | "numoutlets" : 0, 144 | "patching_rect" : [ 423.75, 29.0, 102.0, 24.0 ], 145 | "style" : "", 146 | "text" : "RECEIVE" 147 | } 148 | 149 | } 150 | , { 151 | "box" : { 152 | "id" : "obj-14", 153 | "maxclass" : "newobj", 154 | "numinlets" : 1, 155 | "numoutlets" : 0, 156 | "patching_rect" : [ 420.75, 338.0, 120.0, 22.0 ], 157 | "style" : "", 158 | "text" : "print arg3 @popup 1" 159 | } 160 | 161 | } 162 | , { 163 | "box" : { 164 | "id" : "obj-13", 165 | "maxclass" : "newobj", 166 | "numinlets" : 1, 167 | "numoutlets" : 0, 168 | "patching_rect" : [ 420.75, 297.0, 120.0, 22.0 ], 169 | "style" : "", 170 | "text" : "print arg2 @popup 1" 171 | } 172 | 173 | } 174 | , { 175 | "box" : { 176 | "id" : "obj-12", 177 | "maxclass" : "newobj", 178 | "numinlets" : 1, 179 | "numoutlets" : 0, 180 | "patching_rect" : [ 420.75, 257.0, 120.0, 22.0 ], 181 | "style" : "", 182 | "text" : "print arg1 @popup 1" 183 | } 184 | 185 | } 186 | , { 187 | "box" : { 188 | "id" : "obj-5", 189 | "maxclass" : "newobj", 190 | "numinlets" : 1, 191 | "numoutlets" : 3, 192 | "outlettype" : [ "", "float", "int" ], 193 | "patching_rect" : [ 420.75, 215.0, 82.0, 22.0 ], 194 | "style" : "", 195 | "text" : "unpack x 0. 0" 196 | } 197 | 198 | } 199 | , { 200 | "box" : { 201 | "id" : "obj-11", 202 | "maxclass" : "newobj", 203 | "numinlets" : 2, 204 | "numoutlets" : 4, 205 | "outlettype" : [ "", "", "", "" ], 206 | "patching_rect" : [ 496.75, 167.0, 142.0, 22.0 ], 207 | "saved_object_attributes" : { 208 | "filename" : "oscroute.js", 209 | "parameter_enable" : 0 210 | } 211 | , 212 | "style" : "", 213 | "text" : "js oscroute.js /many /x /y" 214 | } 215 | 216 | } 217 | , { 218 | "box" : { 219 | "fontface" : 0, 220 | "fontname" : "Arial", 221 | "fontsize" : 13.0, 222 | "id" : "obj-9", 223 | "maxclass" : "newobj", 224 | "numinlets" : 1, 225 | "numoutlets" : 0, 226 | "patching_rect" : [ 611.75, 257.0, 110.0, 23.0 ], 227 | "style" : "", 228 | "text" : "print y @popup 1" 229 | } 230 | 231 | } 232 | , { 233 | "box" : { 234 | "id" : "obj-4", 235 | "maxclass" : "newobj", 236 | "numinlets" : 2, 237 | "numoutlets" : 2, 238 | "outlettype" : [ "", "" ], 239 | "patching_rect" : [ 496.75, 118.0, 111.0, 22.0 ], 240 | "saved_object_attributes" : { 241 | "filename" : "oscroute.js", 242 | "parameter_enable" : 0 243 | } 244 | , 245 | "style" : "", 246 | "text" : "js oscroute.js /print" 247 | } 248 | 249 | } 250 | , { 251 | "box" : { 252 | "id" : "obj-3", 253 | "linecount" : 4, 254 | "maxclass" : "comment", 255 | "numinlets" : 1, 256 | "numoutlets" : 0, 257 | "patching_rect" : [ 49.0, 58.0, 149.0, 60.0 ], 258 | "style" : "", 259 | "text" : "the osc paths reflect the names of the node scripts\nthey were designed to work with" 260 | } 261 | 262 | } 263 | , { 264 | "box" : { 265 | "id" : "obj-2", 266 | "linecount" : 5, 267 | "maxclass" : "comment", 268 | "numinlets" : 1, 269 | "numoutlets" : 0, 270 | "patching_rect" : [ 48.0, 241.0, 149.0, 74.0 ], 271 | "style" : "", 272 | "text" : "you can change the destination address to whatever address or hostname you would like to send to" 273 | } 274 | 275 | } 276 | , { 277 | "box" : { 278 | "fontname" : "Arial", 279 | "fontsize" : 13.0, 280 | "id" : "obj-6", 281 | "maxclass" : "message", 282 | "numinlets" : 2, 283 | "numoutlets" : 1, 284 | "outlettype" : [ "" ], 285 | "patching_rect" : [ 49.0, 121.0, 153.0, 23.0 ], 286 | "style" : "", 287 | "text" : "/print/max hello 3.14 100" 288 | } 289 | 290 | } 291 | , { 292 | "box" : { 293 | "fontface" : 0, 294 | "fontname" : "Arial", 295 | "fontsize" : 13.0, 296 | "id" : "obj-10", 297 | "maxclass" : "newobj", 298 | "numinlets" : 1, 299 | "numoutlets" : 0, 300 | "patching_rect" : [ 611.75, 215.0, 110.0, 23.0 ], 301 | "style" : "", 302 | "text" : "print x @popup 1" 303 | } 304 | 305 | } 306 | , { 307 | "box" : { 308 | "fontface" : 0, 309 | "fontname" : "Arial", 310 | "fontsize" : 13.0, 311 | "id" : "obj-22", 312 | "maxclass" : "newobj", 313 | "numinlets" : 1, 314 | "numoutlets" : 1, 315 | "outlettype" : [ "" ], 316 | "patching_rect" : [ 423.75, 62.0, 107.0, 23.0 ], 317 | "style" : "", 318 | "text" : "udpreceive 9999" 319 | } 320 | 321 | } 322 | , { 323 | "box" : { 324 | "fontface" : 0, 325 | "fontname" : "Arial", 326 | "fontsize" : 13.0, 327 | "id" : "obj-24", 328 | "maxclass" : "newobj", 329 | "numinlets" : 1, 330 | "numoutlets" : 0, 331 | "patching_rect" : [ 49.0, 210.0, 148.0, 23.0 ], 332 | "style" : "", 333 | "text" : "udpsend localhost 9998" 334 | } 335 | 336 | } 337 | ], 338 | "lines" : [ { 339 | "patchline" : { 340 | "destination" : [ "obj-18", 0 ], 341 | "disabled" : 0, 342 | "hidden" : 0, 343 | "source" : [ "obj-1", 0 ] 344 | } 345 | 346 | } 347 | , { 348 | "patchline" : { 349 | "destination" : [ "obj-10", 0 ], 350 | "disabled" : 0, 351 | "hidden" : 0, 352 | "midpoints" : [ 547.25, 201.0, 621.25, 201.0 ], 353 | "source" : [ "obj-11", 1 ] 354 | } 355 | 356 | } 357 | , { 358 | "patchline" : { 359 | "destination" : [ "obj-5", 0 ], 360 | "disabled" : 0, 361 | "hidden" : 0, 362 | "midpoints" : [ 506.25, 201.0, 430.25, 201.0 ], 363 | "source" : [ "obj-11", 0 ] 364 | } 365 | 366 | } 367 | , { 368 | "patchline" : { 369 | "destination" : [ "obj-9", 0 ], 370 | "disabled" : 0, 371 | "hidden" : 0, 372 | "midpoints" : [ 588.25, 252.0, 621.25, 252.0 ], 373 | "source" : [ "obj-11", 2 ] 374 | } 375 | 376 | } 377 | , { 378 | "patchline" : { 379 | "destination" : [ "obj-19", 0 ], 380 | "disabled" : 0, 381 | "hidden" : 0, 382 | "source" : [ "obj-18", 0 ] 383 | } 384 | 385 | } 386 | , { 387 | "patchline" : { 388 | "destination" : [ "obj-20", 0 ], 389 | "disabled" : 0, 390 | "hidden" : 0, 391 | "source" : [ "obj-18", 1 ] 392 | } 393 | 394 | } 395 | , { 396 | "patchline" : { 397 | "destination" : [ "obj-1", 0 ], 398 | "disabled" : 0, 399 | "hidden" : 0, 400 | "midpoints" : [ 433.25, 105.0, 257.5, 105.0 ], 401 | "source" : [ "obj-22", 0 ] 402 | } 403 | 404 | } 405 | , { 406 | "patchline" : { 407 | "destination" : [ "obj-4", 0 ], 408 | "disabled" : 0, 409 | "hidden" : 0, 410 | "source" : [ "obj-22", 0 ] 411 | } 412 | 413 | } 414 | , { 415 | "patchline" : { 416 | "destination" : [ "obj-24", 0 ], 417 | "disabled" : 0, 418 | "hidden" : 0, 419 | "source" : [ "obj-26", 0 ] 420 | } 421 | 422 | } 423 | , { 424 | "patchline" : { 425 | "destination" : [ "obj-11", 0 ], 426 | "disabled" : 0, 427 | "hidden" : 0, 428 | "midpoints" : [ 506.25, 159.0, 506.25, 159.0 ], 429 | "source" : [ "obj-4", 0 ] 430 | } 431 | 432 | } 433 | , { 434 | "patchline" : { 435 | "destination" : [ "obj-12", 0 ], 436 | "disabled" : 0, 437 | "hidden" : 0, 438 | "source" : [ "obj-5", 0 ] 439 | } 440 | 441 | } 442 | , { 443 | "patchline" : { 444 | "destination" : [ "obj-13", 0 ], 445 | "disabled" : 0, 446 | "hidden" : 0, 447 | "midpoints" : [ 461.75, 240.0, 407.0, 240.0, 407.0, 291.0, 430.25, 291.0 ], 448 | "source" : [ "obj-5", 1 ] 449 | } 450 | 451 | } 452 | , { 453 | "patchline" : { 454 | "destination" : [ "obj-14", 0 ], 455 | "disabled" : 0, 456 | "hidden" : 0, 457 | "midpoints" : [ 493.25, 240.0, 407.0, 240.0, 407.0, 333.0, 430.25, 333.0 ], 458 | "source" : [ "obj-5", 2 ] 459 | } 460 | 461 | } 462 | , { 463 | "patchline" : { 464 | "destination" : [ "obj-24", 0 ], 465 | "disabled" : 0, 466 | "hidden" : 0, 467 | "midpoints" : [ 58.5, 147.0, 36.0, 147.0, 36.0, 198.0, 58.5, 198.0 ], 468 | "source" : [ "obj-6", 0 ] 469 | } 470 | 471 | } 472 | ], 473 | "dependency_cache" : [ { 474 | "name" : "oscroute.js", 475 | "bootpath" : "~/adafruit-osc-guide/max", 476 | "patcherrelativepath" : ".", 477 | "type" : "TEXT", 478 | "implicit" : 1 479 | } 480 | ], 481 | "embedsnapshot" : 0 482 | } 483 | 484 | } 485 | -------------------------------------------------------------------------------- /max/oscroute.js: -------------------------------------------------------------------------------- 1 | // oscroute.1.0 2 | // James Drake 3 | // from: http://monome.org/docs/app:oscroute 4 | inlets = 2; 5 | outlets = jsarguments.length; 6 | 7 | var jsargs = arrayfromargs(jsarguments); 8 | 9 | function anything() { 10 | var args = arrayfromargs(arguments); 11 | if(inlet == 0) { 12 | var matched = 0; 13 | for(i = 1; i < jsargs.length; i++) { 14 | if(messagename == jsargs[i]) { 15 | outlet(i-1, args); 16 | matched = 1; 17 | } else if(messagename.indexOf(jsargs[i]) == 0 && messagename.charAt(jsargs[i].length) == "/") { 18 | outlet(i-1, messagename.substring(jsargs[i].length), args); 19 | matched = 1; 20 | } 21 | } 22 | if(matched == 0) { 23 | outlet(jsargs.length-1, messagename, args); 24 | } 25 | } else if(inlet == 1) { 26 | for(i = 0; i <= args.length; i++) { 27 | if(i == 0) { 28 | jsargs[i+1] = messagename; 29 | } else { 30 | jsargs[i+1] = args[i-1]; 31 | } 32 | if(i+1 == jsargs.length-1) { 33 | i = args.length+1; 34 | } 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /max/pitft_sample.maxpat: -------------------------------------------------------------------------------- 1 | { 2 | "patcher" : { 3 | "fileversion" : 1, 4 | "appversion" : { 5 | "major" : 7, 6 | "minor" : 0, 7 | "revision" : 2, 8 | "architecture" : "x86", 9 | "modernui" : 1 10 | } 11 | , 12 | "rect" : [ 59.0, 104.0, 791.0, 594.0 ], 13 | "bglocked" : 0, 14 | "openinpresentation" : 0, 15 | "default_fontsize" : 12.0, 16 | "default_fontface" : 0, 17 | "default_fontname" : "Arial", 18 | "gridonopen" : 1, 19 | "gridsize" : [ 15.0, 15.0 ], 20 | "gridsnaponopen" : 1, 21 | "objectsnaponopen" : 1, 22 | "statusbarvisible" : 2, 23 | "toolbarvisible" : 1, 24 | "lefttoolbarpinned" : 0, 25 | "toptoolbarpinned" : 0, 26 | "righttoolbarpinned" : 0, 27 | "bottomtoolbarpinned" : 0, 28 | "toolbars_unpinned_last_save" : 0, 29 | "tallnewobj" : 0, 30 | "boxanimatetime" : 200, 31 | "enablehscroll" : 1, 32 | "enablevscroll" : 1, 33 | "devicewidth" : 0.0, 34 | "description" : "", 35 | "digest" : "", 36 | "tags" : "", 37 | "style" : "", 38 | "subpatcher_template" : "", 39 | "boxes" : [ { 40 | "box" : { 41 | "id" : "obj-53", 42 | "maxclass" : "newobj", 43 | "numinlets" : 5, 44 | "numoutlets" : 5, 45 | "outlettype" : [ "", "", "", "", "" ], 46 | "patching_rect" : [ 24.75, 131.0, 103.0, 22.0 ], 47 | "style" : "", 48 | "text" : "routepass 1 2 3 4" 49 | } 50 | 51 | } 52 | , { 53 | "box" : { 54 | "id" : "obj-50", 55 | "maxclass" : "newobj", 56 | "numinlets" : 1, 57 | "numoutlets" : 2, 58 | "outlettype" : [ "signal", "signal" ], 59 | "patcher" : { 60 | "fileversion" : 1, 61 | "appversion" : { 62 | "major" : 7, 63 | "minor" : 0, 64 | "revision" : 2, 65 | "architecture" : "x86", 66 | "modernui" : 1 67 | } 68 | , 69 | "rect" : [ 520.0, 140.0, 480.0, 480.0 ], 70 | "bglocked" : 0, 71 | "openinpresentation" : 0, 72 | "default_fontsize" : 12.0, 73 | "default_fontface" : 0, 74 | "default_fontname" : "Arial", 75 | "gridonopen" : 1, 76 | "gridsize" : [ 15.0, 15.0 ], 77 | "gridsnaponopen" : 1, 78 | "objectsnaponopen" : 1, 79 | "statusbarvisible" : 2, 80 | "toolbarvisible" : 1, 81 | "lefttoolbarpinned" : 0, 82 | "toptoolbarpinned" : 0, 83 | "righttoolbarpinned" : 0, 84 | "bottomtoolbarpinned" : 0, 85 | "toolbars_unpinned_last_save" : 0, 86 | "tallnewobj" : 0, 87 | "boxanimatetime" : 200, 88 | "enablehscroll" : 1, 89 | "enablevscroll" : 1, 90 | "devicewidth" : 0.0, 91 | "description" : "", 92 | "digest" : "", 93 | "tags" : "", 94 | "style" : "", 95 | "subpatcher_template" : "", 96 | "boxes" : [ { 97 | "box" : { 98 | "comment" : "", 99 | "id" : "obj-4", 100 | "maxclass" : "outlet", 101 | "numinlets" : 1, 102 | "numoutlets" : 0, 103 | "patching_rect" : [ 61.25, 247.0, 30.0, 30.0 ], 104 | "style" : "" 105 | } 106 | 107 | } 108 | , { 109 | "box" : { 110 | "comment" : "", 111 | "id" : "obj-3", 112 | "maxclass" : "inlet", 113 | "numinlets" : 0, 114 | "numoutlets" : 1, 115 | "outlettype" : [ "" ], 116 | "patching_rect" : [ 22.75, 66.0, 30.0, 30.0 ], 117 | "style" : "" 118 | } 119 | 120 | } 121 | , { 122 | "box" : { 123 | "comment" : "", 124 | "id" : "obj-2", 125 | "maxclass" : "outlet", 126 | "numinlets" : 1, 127 | "numoutlets" : 0, 128 | "patching_rect" : [ 19.0, 247.0, 30.0, 30.0 ], 129 | "style" : "" 130 | } 131 | 132 | } 133 | , { 134 | "box" : { 135 | "id" : "obj-12", 136 | "maxclass" : "newobj", 137 | "numinlets" : 1, 138 | "numoutlets" : 1, 139 | "outlettype" : [ "" ], 140 | "patching_rect" : [ 22.75, 130.0, 93.0, 22.0 ], 141 | "style" : "", 142 | "text" : "sprintf sound%i" 143 | } 144 | 145 | } 146 | , { 147 | "box" : { 148 | "id" : "obj-11", 149 | "maxclass" : "newobj", 150 | "numinlets" : 1, 151 | "numoutlets" : 1, 152 | "outlettype" : [ "signal" ], 153 | "patching_rect" : [ 97.0, 162.0, 43.0, 22.0 ], 154 | "style" : "", 155 | "text" : "sig~ 1" 156 | } 157 | 158 | } 159 | , { 160 | "box" : { 161 | "id" : "obj-9", 162 | "maxclass" : "message", 163 | "numinlets" : 2, 164 | "numoutlets" : 1, 165 | "outlettype" : [ "" ], 166 | "patching_rect" : [ 22.75, 162.0, 57.0, 22.0 ], 167 | "style" : "", 168 | "text" : "set $1, 0" 169 | } 170 | 171 | } 172 | , { 173 | "box" : { 174 | "id" : "obj-6", 175 | "maxclass" : "newobj", 176 | "numinlets" : 3, 177 | "numoutlets" : 3, 178 | "outlettype" : [ "signal", "signal", "signal" ], 179 | "patching_rect" : [ 22.75, 205.0, 74.0, 22.0 ], 180 | "saved_object_attributes" : { 181 | "basictuning" : 440, 182 | "followglobaltempo" : 0, 183 | "formantcorrection" : 0, 184 | "loopend" : [ 0.0, "ms" ], 185 | "loopstart" : [ 0.0, "ms" ], 186 | "mode" : "basic", 187 | "originallength" : [ 0.0, "ticks" ], 188 | "originaltempo" : 120.0, 189 | "phase" : [ 0.0, "ticks" ], 190 | "pitchcorrection" : 0, 191 | "quality" : "basic", 192 | "timestretch" : [ 0 ] 193 | } 194 | , 195 | "style" : "", 196 | "text" : "groove~ s 2" 197 | } 198 | 199 | } 200 | ], 201 | "lines" : [ { 202 | "patchline" : { 203 | "destination" : [ "obj-6", 0 ], 204 | "disabled" : 0, 205 | "hidden" : 0, 206 | "source" : [ "obj-11", 0 ] 207 | } 208 | 209 | } 210 | , { 211 | "patchline" : { 212 | "destination" : [ "obj-9", 0 ], 213 | "disabled" : 0, 214 | "hidden" : 0, 215 | "source" : [ "obj-12", 0 ] 216 | } 217 | 218 | } 219 | , { 220 | "patchline" : { 221 | "destination" : [ "obj-12", 0 ], 222 | "disabled" : 0, 223 | "hidden" : 0, 224 | "source" : [ "obj-3", 0 ] 225 | } 226 | 227 | } 228 | , { 229 | "patchline" : { 230 | "destination" : [ "obj-2", 0 ], 231 | "disabled" : 0, 232 | "hidden" : 0, 233 | "source" : [ "obj-6", 0 ] 234 | } 235 | 236 | } 237 | , { 238 | "patchline" : { 239 | "destination" : [ "obj-4", 0 ], 240 | "disabled" : 0, 241 | "hidden" : 0, 242 | "source" : [ "obj-6", 1 ] 243 | } 244 | 245 | } 246 | , { 247 | "patchline" : { 248 | "destination" : [ "obj-6", 0 ], 249 | "disabled" : 0, 250 | "hidden" : 0, 251 | "source" : [ "obj-9", 0 ] 252 | } 253 | 254 | } 255 | ] 256 | } 257 | , 258 | "patching_rect" : [ 92.75, 276.0, 53.0, 22.0 ], 259 | "saved_object_attributes" : { 260 | "description" : "", 261 | "digest" : "", 262 | "globalpatchername" : "", 263 | "style" : "", 264 | "tags" : "" 265 | } 266 | , 267 | "style" : "", 268 | "text" : "p player" 269 | } 270 | 271 | } 272 | , { 273 | "box" : { 274 | "id" : "obj-49", 275 | "maxclass" : "newobj", 276 | "numinlets" : 1, 277 | "numoutlets" : 2, 278 | "outlettype" : [ "signal", "signal" ], 279 | "patcher" : { 280 | "fileversion" : 1, 281 | "appversion" : { 282 | "major" : 7, 283 | "minor" : 0, 284 | "revision" : 2, 285 | "architecture" : "x86", 286 | "modernui" : 1 287 | } 288 | , 289 | "rect" : [ 520.0, 140.0, 640.0, 480.0 ], 290 | "bglocked" : 0, 291 | "openinpresentation" : 0, 292 | "default_fontsize" : 12.0, 293 | "default_fontface" : 0, 294 | "default_fontname" : "Arial", 295 | "gridonopen" : 1, 296 | "gridsize" : [ 15.0, 15.0 ], 297 | "gridsnaponopen" : 1, 298 | "objectsnaponopen" : 1, 299 | "statusbarvisible" : 2, 300 | "toolbarvisible" : 1, 301 | "lefttoolbarpinned" : 0, 302 | "toptoolbarpinned" : 0, 303 | "righttoolbarpinned" : 0, 304 | "bottomtoolbarpinned" : 0, 305 | "toolbars_unpinned_last_save" : 0, 306 | "tallnewobj" : 0, 307 | "boxanimatetime" : 200, 308 | "enablehscroll" : 1, 309 | "enablevscroll" : 1, 310 | "devicewidth" : 0.0, 311 | "description" : "", 312 | "digest" : "", 313 | "tags" : "", 314 | "style" : "", 315 | "subpatcher_template" : "", 316 | "boxes" : [ { 317 | "box" : { 318 | "comment" : "", 319 | "id" : "obj-4", 320 | "maxclass" : "outlet", 321 | "numinlets" : 1, 322 | "numoutlets" : 0, 323 | "patching_rect" : [ 61.25, 247.0, 30.0, 30.0 ], 324 | "style" : "" 325 | } 326 | 327 | } 328 | , { 329 | "box" : { 330 | "comment" : "", 331 | "id" : "obj-3", 332 | "maxclass" : "inlet", 333 | "numinlets" : 0, 334 | "numoutlets" : 1, 335 | "outlettype" : [ "" ], 336 | "patching_rect" : [ 22.75, 66.0, 30.0, 30.0 ], 337 | "style" : "" 338 | } 339 | 340 | } 341 | , { 342 | "box" : { 343 | "comment" : "", 344 | "id" : "obj-2", 345 | "maxclass" : "outlet", 346 | "numinlets" : 1, 347 | "numoutlets" : 0, 348 | "patching_rect" : [ 19.0, 247.0, 30.0, 30.0 ], 349 | "style" : "" 350 | } 351 | 352 | } 353 | , { 354 | "box" : { 355 | "id" : "obj-12", 356 | "maxclass" : "newobj", 357 | "numinlets" : 1, 358 | "numoutlets" : 1, 359 | "outlettype" : [ "" ], 360 | "patching_rect" : [ 22.75, 130.0, 93.0, 22.0 ], 361 | "style" : "", 362 | "text" : "sprintf sound%i" 363 | } 364 | 365 | } 366 | , { 367 | "box" : { 368 | "id" : "obj-11", 369 | "maxclass" : "newobj", 370 | "numinlets" : 1, 371 | "numoutlets" : 1, 372 | "outlettype" : [ "signal" ], 373 | "patching_rect" : [ 97.0, 162.0, 43.0, 22.0 ], 374 | "style" : "", 375 | "text" : "sig~ 1" 376 | } 377 | 378 | } 379 | , { 380 | "box" : { 381 | "id" : "obj-9", 382 | "maxclass" : "message", 383 | "numinlets" : 2, 384 | "numoutlets" : 1, 385 | "outlettype" : [ "" ], 386 | "patching_rect" : [ 22.75, 162.0, 57.0, 22.0 ], 387 | "style" : "", 388 | "text" : "set $1, 0" 389 | } 390 | 391 | } 392 | , { 393 | "box" : { 394 | "id" : "obj-6", 395 | "maxclass" : "newobj", 396 | "numinlets" : 3, 397 | "numoutlets" : 3, 398 | "outlettype" : [ "signal", "signal", "signal" ], 399 | "patching_rect" : [ 22.75, 204.0, 107.0, 22.0 ], 400 | "saved_object_attributes" : { 401 | "basictuning" : 440, 402 | "followglobaltempo" : 0, 403 | "formantcorrection" : 0, 404 | "loopend" : [ 0.0, "ms" ], 405 | "loopstart" : [ 0.0, "ms" ], 406 | "mode" : "basic", 407 | "originallength" : [ 14454.616211, "ticks" ], 408 | "originaltempo" : 21403.677734, 409 | "phase" : [ 0.0, "ticks" ], 410 | "pitchcorrection" : 0, 411 | "quality" : "basic", 412 | "timestretch" : [ 0 ] 413 | } 414 | , 415 | "style" : "", 416 | "text" : "groove~ sound1 2" 417 | } 418 | 419 | } 420 | ], 421 | "lines" : [ { 422 | "patchline" : { 423 | "destination" : [ "obj-6", 0 ], 424 | "disabled" : 0, 425 | "hidden" : 0, 426 | "source" : [ "obj-11", 0 ] 427 | } 428 | 429 | } 430 | , { 431 | "patchline" : { 432 | "destination" : [ "obj-9", 0 ], 433 | "disabled" : 0, 434 | "hidden" : 0, 435 | "source" : [ "obj-12", 0 ] 436 | } 437 | 438 | } 439 | , { 440 | "patchline" : { 441 | "destination" : [ "obj-12", 0 ], 442 | "disabled" : 0, 443 | "hidden" : 0, 444 | "source" : [ "obj-3", 0 ] 445 | } 446 | 447 | } 448 | , { 449 | "patchline" : { 450 | "destination" : [ "obj-2", 0 ], 451 | "disabled" : 0, 452 | "hidden" : 0, 453 | "source" : [ "obj-6", 0 ] 454 | } 455 | 456 | } 457 | , { 458 | "patchline" : { 459 | "destination" : [ "obj-4", 0 ], 460 | "disabled" : 0, 461 | "hidden" : 0, 462 | "source" : [ "obj-6", 1 ] 463 | } 464 | 465 | } 466 | , { 467 | "patchline" : { 468 | "destination" : [ "obj-6", 0 ], 469 | "disabled" : 0, 470 | "hidden" : 0, 471 | "source" : [ "obj-9", 0 ] 472 | } 473 | 474 | } 475 | ] 476 | } 477 | , 478 | "patching_rect" : [ 92.75, 225.0, 53.0, 22.0 ], 479 | "saved_object_attributes" : { 480 | "description" : "", 481 | "digest" : "", 482 | "globalpatchername" : "", 483 | "style" : "", 484 | "tags" : "" 485 | } 486 | , 487 | "style" : "", 488 | "text" : "p player" 489 | } 490 | 491 | } 492 | , { 493 | "box" : { 494 | "id" : "obj-48", 495 | "maxclass" : "newobj", 496 | "numinlets" : 1, 497 | "numoutlets" : 2, 498 | "outlettype" : [ "signal", "signal" ], 499 | "patcher" : { 500 | "fileversion" : 1, 501 | "appversion" : { 502 | "major" : 7, 503 | "minor" : 0, 504 | "revision" : 2, 505 | "architecture" : "x86", 506 | "modernui" : 1 507 | } 508 | , 509 | "rect" : [ 520.0, 140.0, 640.0, 480.0 ], 510 | "bglocked" : 0, 511 | "openinpresentation" : 0, 512 | "default_fontsize" : 12.0, 513 | "default_fontface" : 0, 514 | "default_fontname" : "Arial", 515 | "gridonopen" : 1, 516 | "gridsize" : [ 15.0, 15.0 ], 517 | "gridsnaponopen" : 1, 518 | "objectsnaponopen" : 1, 519 | "statusbarvisible" : 2, 520 | "toolbarvisible" : 1, 521 | "lefttoolbarpinned" : 0, 522 | "toptoolbarpinned" : 0, 523 | "righttoolbarpinned" : 0, 524 | "bottomtoolbarpinned" : 0, 525 | "toolbars_unpinned_last_save" : 0, 526 | "tallnewobj" : 0, 527 | "boxanimatetime" : 200, 528 | "enablehscroll" : 1, 529 | "enablevscroll" : 1, 530 | "devicewidth" : 0.0, 531 | "description" : "", 532 | "digest" : "", 533 | "tags" : "", 534 | "style" : "", 535 | "subpatcher_template" : "", 536 | "boxes" : [ { 537 | "box" : { 538 | "comment" : "", 539 | "id" : "obj-4", 540 | "maxclass" : "outlet", 541 | "numinlets" : 1, 542 | "numoutlets" : 0, 543 | "patching_rect" : [ 61.25, 247.0, 30.0, 30.0 ], 544 | "style" : "" 545 | } 546 | 547 | } 548 | , { 549 | "box" : { 550 | "comment" : "", 551 | "id" : "obj-3", 552 | "maxclass" : "inlet", 553 | "numinlets" : 0, 554 | "numoutlets" : 1, 555 | "outlettype" : [ "" ], 556 | "patching_rect" : [ 22.75, 66.0, 30.0, 30.0 ], 557 | "style" : "" 558 | } 559 | 560 | } 561 | , { 562 | "box" : { 563 | "comment" : "", 564 | "id" : "obj-2", 565 | "maxclass" : "outlet", 566 | "numinlets" : 1, 567 | "numoutlets" : 0, 568 | "patching_rect" : [ 19.0, 247.0, 30.0, 30.0 ], 569 | "style" : "" 570 | } 571 | 572 | } 573 | , { 574 | "box" : { 575 | "id" : "obj-12", 576 | "maxclass" : "newobj", 577 | "numinlets" : 1, 578 | "numoutlets" : 1, 579 | "outlettype" : [ "" ], 580 | "patching_rect" : [ 22.75, 130.0, 93.0, 22.0 ], 581 | "style" : "", 582 | "text" : "sprintf sound%i" 583 | } 584 | 585 | } 586 | , { 587 | "box" : { 588 | "id" : "obj-11", 589 | "maxclass" : "newobj", 590 | "numinlets" : 1, 591 | "numoutlets" : 1, 592 | "outlettype" : [ "signal" ], 593 | "patching_rect" : [ 97.0, 162.0, 43.0, 22.0 ], 594 | "style" : "", 595 | "text" : "sig~ 1" 596 | } 597 | 598 | } 599 | , { 600 | "box" : { 601 | "id" : "obj-9", 602 | "maxclass" : "message", 603 | "numinlets" : 2, 604 | "numoutlets" : 1, 605 | "outlettype" : [ "" ], 606 | "patching_rect" : [ 22.75, 162.0, 57.0, 22.0 ], 607 | "style" : "", 608 | "text" : "set $1, 0" 609 | } 610 | 611 | } 612 | , { 613 | "box" : { 614 | "id" : "obj-6", 615 | "maxclass" : "newobj", 616 | "numinlets" : 3, 617 | "numoutlets" : 3, 618 | "outlettype" : [ "signal", "signal", "signal" ], 619 | "patching_rect" : [ 22.75, 204.0, 107.0, 22.0 ], 620 | "saved_object_attributes" : { 621 | "basictuning" : 440, 622 | "followglobaltempo" : 0, 623 | "formantcorrection" : 0, 624 | "loopend" : [ 0.0, "ms" ], 625 | "loopstart" : [ 0.0, "ms" ], 626 | "mode" : "basic", 627 | "originallength" : [ 14454.616211, "ticks" ], 628 | "originaltempo" : 4066.186768, 629 | "phase" : [ 0.0, "ticks" ], 630 | "pitchcorrection" : 0, 631 | "quality" : "basic", 632 | "timestretch" : [ 0 ] 633 | } 634 | , 635 | "style" : "", 636 | "text" : "groove~ sound1 2" 637 | } 638 | 639 | } 640 | ], 641 | "lines" : [ { 642 | "patchline" : { 643 | "destination" : [ "obj-6", 0 ], 644 | "disabled" : 0, 645 | "hidden" : 0, 646 | "source" : [ "obj-11", 0 ] 647 | } 648 | 649 | } 650 | , { 651 | "patchline" : { 652 | "destination" : [ "obj-9", 0 ], 653 | "disabled" : 0, 654 | "hidden" : 0, 655 | "source" : [ "obj-12", 0 ] 656 | } 657 | 658 | } 659 | , { 660 | "patchline" : { 661 | "destination" : [ "obj-12", 0 ], 662 | "disabled" : 0, 663 | "hidden" : 0, 664 | "source" : [ "obj-3", 0 ] 665 | } 666 | 667 | } 668 | , { 669 | "patchline" : { 670 | "destination" : [ "obj-2", 0 ], 671 | "disabled" : 0, 672 | "hidden" : 0, 673 | "source" : [ "obj-6", 0 ] 674 | } 675 | 676 | } 677 | , { 678 | "patchline" : { 679 | "destination" : [ "obj-4", 0 ], 680 | "disabled" : 0, 681 | "hidden" : 0, 682 | "source" : [ "obj-6", 1 ] 683 | } 684 | 685 | } 686 | , { 687 | "patchline" : { 688 | "destination" : [ "obj-6", 0 ], 689 | "disabled" : 0, 690 | "hidden" : 0, 691 | "source" : [ "obj-9", 0 ] 692 | } 693 | 694 | } 695 | ] 696 | } 697 | , 698 | "patching_rect" : [ 83.75, 173.0, 53.0, 22.0 ], 699 | "saved_object_attributes" : { 700 | "description" : "", 701 | "digest" : "", 702 | "globalpatchername" : "", 703 | "style" : "", 704 | "tags" : "" 705 | } 706 | , 707 | "style" : "", 708 | "text" : "p player" 709 | } 710 | 711 | } 712 | , { 713 | "box" : { 714 | "id" : "obj-18", 715 | "maxclass" : "newobj", 716 | "numinlets" : 1, 717 | "numoutlets" : 2, 718 | "outlettype" : [ "signal", "signal" ], 719 | "patcher" : { 720 | "fileversion" : 1, 721 | "appversion" : { 722 | "major" : 7, 723 | "minor" : 0, 724 | "revision" : 2, 725 | "architecture" : "x86", 726 | "modernui" : 1 727 | } 728 | , 729 | "rect" : [ 520.0, 140.0, 640.0, 480.0 ], 730 | "bglocked" : 0, 731 | "openinpresentation" : 0, 732 | "default_fontsize" : 12.0, 733 | "default_fontface" : 0, 734 | "default_fontname" : "Arial", 735 | "gridonopen" : 1, 736 | "gridsize" : [ 15.0, 15.0 ], 737 | "gridsnaponopen" : 1, 738 | "objectsnaponopen" : 1, 739 | "statusbarvisible" : 2, 740 | "toolbarvisible" : 1, 741 | "lefttoolbarpinned" : 0, 742 | "toptoolbarpinned" : 0, 743 | "righttoolbarpinned" : 0, 744 | "bottomtoolbarpinned" : 0, 745 | "toolbars_unpinned_last_save" : 0, 746 | "tallnewobj" : 0, 747 | "boxanimatetime" : 200, 748 | "enablehscroll" : 1, 749 | "enablevscroll" : 1, 750 | "devicewidth" : 0.0, 751 | "description" : "", 752 | "digest" : "", 753 | "tags" : "", 754 | "style" : "", 755 | "subpatcher_template" : "", 756 | "boxes" : [ { 757 | "box" : { 758 | "comment" : "", 759 | "id" : "obj-4", 760 | "maxclass" : "outlet", 761 | "numinlets" : 1, 762 | "numoutlets" : 0, 763 | "patching_rect" : [ 61.25, 247.0, 30.0, 30.0 ], 764 | "style" : "" 765 | } 766 | 767 | } 768 | , { 769 | "box" : { 770 | "comment" : "", 771 | "id" : "obj-3", 772 | "maxclass" : "inlet", 773 | "numinlets" : 0, 774 | "numoutlets" : 1, 775 | "outlettype" : [ "" ], 776 | "patching_rect" : [ 22.75, 66.0, 30.0, 30.0 ], 777 | "style" : "" 778 | } 779 | 780 | } 781 | , { 782 | "box" : { 783 | "comment" : "", 784 | "id" : "obj-2", 785 | "maxclass" : "outlet", 786 | "numinlets" : 1, 787 | "numoutlets" : 0, 788 | "patching_rect" : [ 19.0, 247.0, 30.0, 30.0 ], 789 | "style" : "" 790 | } 791 | 792 | } 793 | , { 794 | "box" : { 795 | "id" : "obj-12", 796 | "maxclass" : "newobj", 797 | "numinlets" : 1, 798 | "numoutlets" : 1, 799 | "outlettype" : [ "" ], 800 | "patching_rect" : [ 22.75, 130.0, 93.0, 22.0 ], 801 | "style" : "", 802 | "text" : "sprintf sound%i" 803 | } 804 | 805 | } 806 | , { 807 | "box" : { 808 | "id" : "obj-11", 809 | "maxclass" : "newobj", 810 | "numinlets" : 1, 811 | "numoutlets" : 1, 812 | "outlettype" : [ "signal" ], 813 | "patching_rect" : [ 97.0, 162.0, 43.0, 22.0 ], 814 | "style" : "", 815 | "text" : "sig~ 1" 816 | } 817 | 818 | } 819 | , { 820 | "box" : { 821 | "id" : "obj-9", 822 | "maxclass" : "message", 823 | "numinlets" : 2, 824 | "numoutlets" : 1, 825 | "outlettype" : [ "" ], 826 | "patching_rect" : [ 22.75, 162.0, 57.0, 22.0 ], 827 | "style" : "", 828 | "text" : "set $1, 0" 829 | } 830 | 831 | } 832 | , { 833 | "box" : { 834 | "id" : "obj-6", 835 | "maxclass" : "newobj", 836 | "numinlets" : 3, 837 | "numoutlets" : 3, 838 | "outlettype" : [ "signal", "signal", "signal" ], 839 | "patching_rect" : [ 22.75, 204.0, 107.0, 22.0 ], 840 | "saved_object_attributes" : { 841 | "basictuning" : 440, 842 | "followglobaltempo" : 0, 843 | "formantcorrection" : 0, 844 | "loopend" : [ 0.0, "ms" ], 845 | "loopstart" : [ 0.0, "ms" ], 846 | "mode" : "basic", 847 | "originallength" : [ 14454.616211, "ticks" ], 848 | "originaltempo" : 15393.62793, 849 | "phase" : [ 0.0, "ticks" ], 850 | "pitchcorrection" : 0, 851 | "quality" : "basic", 852 | "timestretch" : [ 0 ] 853 | } 854 | , 855 | "style" : "", 856 | "text" : "groove~ sound1 2" 857 | } 858 | 859 | } 860 | ], 861 | "lines" : [ { 862 | "patchline" : { 863 | "destination" : [ "obj-6", 0 ], 864 | "disabled" : 0, 865 | "hidden" : 0, 866 | "source" : [ "obj-11", 0 ] 867 | } 868 | 869 | } 870 | , { 871 | "patchline" : { 872 | "destination" : [ "obj-9", 0 ], 873 | "disabled" : 0, 874 | "hidden" : 0, 875 | "source" : [ "obj-12", 0 ] 876 | } 877 | 878 | } 879 | , { 880 | "patchline" : { 881 | "destination" : [ "obj-12", 0 ], 882 | "disabled" : 0, 883 | "hidden" : 0, 884 | "source" : [ "obj-3", 0 ] 885 | } 886 | 887 | } 888 | , { 889 | "patchline" : { 890 | "destination" : [ "obj-2", 0 ], 891 | "disabled" : 0, 892 | "hidden" : 0, 893 | "source" : [ "obj-6", 0 ] 894 | } 895 | 896 | } 897 | , { 898 | "patchline" : { 899 | "destination" : [ "obj-4", 0 ], 900 | "disabled" : 0, 901 | "hidden" : 0, 902 | "source" : [ "obj-6", 1 ] 903 | } 904 | 905 | } 906 | , { 907 | "patchline" : { 908 | "destination" : [ "obj-6", 0 ], 909 | "disabled" : 0, 910 | "hidden" : 0, 911 | "source" : [ "obj-9", 0 ] 912 | } 913 | 914 | } 915 | ] 916 | } 917 | , 918 | "patching_rect" : [ 22.75, 173.0, 53.0, 22.0 ], 919 | "saved_object_attributes" : { 920 | "description" : "", 921 | "digest" : "", 922 | "globalpatchername" : "", 923 | "style" : "", 924 | "tags" : "" 925 | } 926 | , 927 | "style" : "", 928 | "text" : "p player" 929 | } 930 | 931 | } 932 | , { 933 | "box" : { 934 | "id" : "obj-46", 935 | "maxclass" : "button", 936 | "numinlets" : 1, 937 | "numoutlets" : 1, 938 | "outlettype" : [ "bang" ], 939 | "patching_rect" : [ 708.0, 1.5, 24.0, 24.0 ], 940 | "style" : "" 941 | } 942 | 943 | } 944 | , { 945 | "box" : { 946 | "id" : "obj-38", 947 | "maxclass" : "newobj", 948 | "numinlets" : 1, 949 | "numoutlets" : 1, 950 | "outlettype" : [ "" ], 951 | "patching_rect" : [ 612.0, 331.0, 65.0, 22.0 ], 952 | "style" : "", 953 | "text" : "prepend 4" 954 | } 955 | 956 | } 957 | , { 958 | "box" : { 959 | "id" : "obj-39", 960 | "maxclass" : "newobj", 961 | "numinlets" : 1, 962 | "numoutlets" : 2, 963 | "outlettype" : [ "", "int" ], 964 | "patching_rect" : [ 543.0, 331.0, 57.0, 22.0 ], 965 | "style" : "", 966 | "text" : "strippath" 967 | } 968 | 969 | } 970 | , { 971 | "box" : { 972 | "id" : "obj-40", 973 | "maxclass" : "message", 974 | "numinlets" : 2, 975 | "numoutlets" : 1, 976 | "outlettype" : [ "" ], 977 | "patching_rect" : [ 367.0, 294.0, 55.0, 22.0 ], 978 | "style" : "", 979 | "text" : "clave.aif" 980 | } 981 | 982 | } 983 | , { 984 | "box" : { 985 | "id" : "obj-42", 986 | "maxclass" : "comment", 987 | "numinlets" : 1, 988 | "numoutlets" : 0, 989 | "patching_rect" : [ 246.0, 331.0, 150.0, 20.0 ], 990 | "style" : "", 991 | "text" : "drop file here" 992 | } 993 | 994 | } 995 | , { 996 | "box" : { 997 | "bordercolor" : [ 0.960784, 0.827451, 0.156863, 1.0 ], 998 | "id" : "obj-43", 999 | "maxclass" : "dropfile", 1000 | "numinlets" : 1, 1001 | "numoutlets" : 2, 1002 | "outlettype" : [ "", "" ], 1003 | "patching_rect" : [ 221.0, 331.0, 134.0, 22.0 ] 1004 | } 1005 | 1006 | } 1007 | , { 1008 | "box" : { 1009 | "id" : "obj-44", 1010 | "maxclass" : "message", 1011 | "numinlets" : 2, 1012 | "numoutlets" : 1, 1013 | "outlettype" : [ "" ], 1014 | "patching_rect" : [ 367.0, 331.0, 67.0, 22.0 ], 1015 | "style" : "", 1016 | "text" : "replace $1" 1017 | } 1018 | 1019 | } 1020 | , { 1021 | "box" : { 1022 | "id" : "obj-45", 1023 | "maxclass" : "newobj", 1024 | "numinlets" : 1, 1025 | "numoutlets" : 2, 1026 | "outlettype" : [ "float", "bang" ], 1027 | "patching_rect" : [ 442.0, 331.0, 91.0, 22.0 ], 1028 | "style" : "", 1029 | "text" : "buffer~ sound4" 1030 | } 1031 | 1032 | } 1033 | , { 1034 | "box" : { 1035 | "id" : "obj-28", 1036 | "maxclass" : "newobj", 1037 | "numinlets" : 1, 1038 | "numoutlets" : 1, 1039 | "outlettype" : [ "" ], 1040 | "patching_rect" : [ 612.0, 246.0, 65.0, 22.0 ], 1041 | "style" : "", 1042 | "text" : "prepend 3" 1043 | } 1044 | 1045 | } 1046 | , { 1047 | "box" : { 1048 | "id" : "obj-29", 1049 | "maxclass" : "newobj", 1050 | "numinlets" : 1, 1051 | "numoutlets" : 2, 1052 | "outlettype" : [ "", "int" ], 1053 | "patching_rect" : [ 543.0, 246.0, 57.0, 22.0 ], 1054 | "style" : "", 1055 | "text" : "strippath" 1056 | } 1057 | 1058 | } 1059 | , { 1060 | "box" : { 1061 | "id" : "obj-30", 1062 | "maxclass" : "message", 1063 | "numinlets" : 2, 1064 | "numoutlets" : 1, 1065 | "outlettype" : [ "" ], 1066 | "patching_rect" : [ 367.0, 209.0, 43.0, 22.0 ], 1067 | "style" : "", 1068 | "text" : "hat.aif" 1069 | } 1070 | 1071 | } 1072 | , { 1073 | "box" : { 1074 | "id" : "obj-32", 1075 | "maxclass" : "comment", 1076 | "numinlets" : 1, 1077 | "numoutlets" : 0, 1078 | "patching_rect" : [ 246.0, 246.0, 150.0, 20.0 ], 1079 | "style" : "", 1080 | "text" : "drop file here" 1081 | } 1082 | 1083 | } 1084 | , { 1085 | "box" : { 1086 | "bordercolor" : [ 0.960784, 0.827451, 0.156863, 1.0 ], 1087 | "id" : "obj-33", 1088 | "maxclass" : "dropfile", 1089 | "numinlets" : 1, 1090 | "numoutlets" : 2, 1091 | "outlettype" : [ "", "" ], 1092 | "patching_rect" : [ 221.0, 246.0, 134.0, 22.0 ] 1093 | } 1094 | 1095 | } 1096 | , { 1097 | "box" : { 1098 | "id" : "obj-36", 1099 | "maxclass" : "message", 1100 | "numinlets" : 2, 1101 | "numoutlets" : 1, 1102 | "outlettype" : [ "" ], 1103 | "patching_rect" : [ 367.0, 246.0, 67.0, 22.0 ], 1104 | "style" : "", 1105 | "text" : "replace $1" 1106 | } 1107 | 1108 | } 1109 | , { 1110 | "box" : { 1111 | "id" : "obj-37", 1112 | "maxclass" : "newobj", 1113 | "numinlets" : 1, 1114 | "numoutlets" : 2, 1115 | "outlettype" : [ "float", "bang" ], 1116 | "patching_rect" : [ 442.0, 246.0, 91.0, 22.0 ], 1117 | "style" : "", 1118 | "text" : "buffer~ sound3" 1119 | } 1120 | 1121 | } 1122 | , { 1123 | "box" : { 1124 | "id" : "obj-19", 1125 | "maxclass" : "newobj", 1126 | "numinlets" : 1, 1127 | "numoutlets" : 1, 1128 | "outlettype" : [ "" ], 1129 | "patching_rect" : [ 612.0, 159.0, 65.0, 22.0 ], 1130 | "style" : "", 1131 | "text" : "prepend 2" 1132 | } 1133 | 1134 | } 1135 | , { 1136 | "box" : { 1137 | "id" : "obj-20", 1138 | "maxclass" : "newobj", 1139 | "numinlets" : 1, 1140 | "numoutlets" : 2, 1141 | "outlettype" : [ "", "int" ], 1142 | "patching_rect" : [ 543.0, 159.0, 57.0, 22.0 ], 1143 | "style" : "", 1144 | "text" : "strippath" 1145 | } 1146 | 1147 | } 1148 | , { 1149 | "box" : { 1150 | "id" : "obj-21", 1151 | "maxclass" : "message", 1152 | "numinlets" : 2, 1153 | "numoutlets" : 1, 1154 | "outlettype" : [ "" ], 1155 | "patching_rect" : [ 367.0, 122.0, 57.0, 22.0 ], 1156 | "style" : "", 1157 | "text" : "snare.aif" 1158 | } 1159 | 1160 | } 1161 | , { 1162 | "box" : { 1163 | "id" : "obj-23", 1164 | "maxclass" : "comment", 1165 | "numinlets" : 1, 1166 | "numoutlets" : 0, 1167 | "patching_rect" : [ 246.0, 159.0, 150.0, 20.0 ], 1168 | "style" : "", 1169 | "text" : "drop file here" 1170 | } 1171 | 1172 | } 1173 | , { 1174 | "box" : { 1175 | "bordercolor" : [ 0.960784, 0.827451, 0.156863, 1.0 ], 1176 | "id" : "obj-25", 1177 | "maxclass" : "dropfile", 1178 | "numinlets" : 1, 1179 | "numoutlets" : 2, 1180 | "outlettype" : [ "", "" ], 1181 | "patching_rect" : [ 221.0, 159.0, 134.0, 22.0 ] 1182 | } 1183 | 1184 | } 1185 | , { 1186 | "box" : { 1187 | "id" : "obj-26", 1188 | "maxclass" : "message", 1189 | "numinlets" : 2, 1190 | "numoutlets" : 1, 1191 | "outlettype" : [ "" ], 1192 | "patching_rect" : [ 367.0, 159.0, 67.0, 22.0 ], 1193 | "style" : "", 1194 | "text" : "replace $1" 1195 | } 1196 | 1197 | } 1198 | , { 1199 | "box" : { 1200 | "id" : "obj-27", 1201 | "maxclass" : "newobj", 1202 | "numinlets" : 1, 1203 | "numoutlets" : 2, 1204 | "outlettype" : [ "float", "bang" ], 1205 | "patching_rect" : [ 442.0, 159.0, 91.0, 22.0 ], 1206 | "style" : "", 1207 | "text" : "buffer~ sound2" 1208 | } 1209 | 1210 | } 1211 | , { 1212 | "box" : { 1213 | "id" : "obj-3", 1214 | "maxclass" : "newobj", 1215 | "numinlets" : 1, 1216 | "numoutlets" : 1, 1217 | "outlettype" : [ "" ], 1218 | "patching_rect" : [ 612.0, 76.0, 65.0, 22.0 ], 1219 | "style" : "", 1220 | "text" : "prepend 1" 1221 | } 1222 | 1223 | } 1224 | , { 1225 | "box" : { 1226 | "id" : "obj-41", 1227 | "maxclass" : "newobj", 1228 | "numinlets" : 1, 1229 | "numoutlets" : 2, 1230 | "outlettype" : [ "", "int" ], 1231 | "patching_rect" : [ 543.0, 76.0, 57.0, 22.0 ], 1232 | "style" : "", 1233 | "text" : "strippath" 1234 | } 1235 | 1236 | } 1237 | , { 1238 | "box" : { 1239 | "id" : "obj-34", 1240 | "maxclass" : "newobj", 1241 | "numinlets" : 1, 1242 | "numoutlets" : 1, 1243 | "outlettype" : [ "bang" ], 1244 | "patching_rect" : [ 637.5, 1.5, 60.0, 22.0 ], 1245 | "style" : "", 1246 | "text" : "loadbang" 1247 | } 1248 | 1249 | } 1250 | , { 1251 | "box" : { 1252 | "id" : "obj-4", 1253 | "maxclass" : "message", 1254 | "numinlets" : 2, 1255 | "numoutlets" : 1, 1256 | "outlettype" : [ "" ], 1257 | "patching_rect" : [ 367.0, 39.0, 47.0, 22.0 ], 1258 | "style" : "", 1259 | "text" : "kick.aif" 1260 | } 1261 | 1262 | } 1263 | , { 1264 | "box" : { 1265 | "id" : "obj-7", 1266 | "maxclass" : "comment", 1267 | "numinlets" : 1, 1268 | "numoutlets" : 0, 1269 | "patching_rect" : [ 246.0, 76.0, 150.0, 20.0 ], 1270 | "style" : "", 1271 | "text" : "drop file here" 1272 | } 1273 | 1274 | } 1275 | , { 1276 | "box" : { 1277 | "bordercolor" : [ 0.960784, 0.827451, 0.156863, 1.0 ], 1278 | "id" : "obj-5", 1279 | "maxclass" : "dropfile", 1280 | "numinlets" : 1, 1281 | "numoutlets" : 2, 1282 | "outlettype" : [ "", "" ], 1283 | "patching_rect" : [ 221.0, 76.0, 134.0, 22.0 ] 1284 | } 1285 | 1286 | } 1287 | , { 1288 | "box" : { 1289 | "id" : "obj-14", 1290 | "maxclass" : "message", 1291 | "numinlets" : 2, 1292 | "numoutlets" : 1, 1293 | "outlettype" : [ "" ], 1294 | "patching_rect" : [ 310.0, 423.0, 103.0, 22.0 ], 1295 | "style" : "", 1296 | "text" : "/pitft/button $1 $2" 1297 | } 1298 | 1299 | } 1300 | , { 1301 | "box" : { 1302 | "id" : "obj-13", 1303 | "maxclass" : "message", 1304 | "numinlets" : 2, 1305 | "numoutlets" : 1, 1306 | "outlettype" : [ "" ], 1307 | "patching_rect" : [ 367.0, 76.0, 67.0, 22.0 ], 1308 | "style" : "", 1309 | "text" : "replace $1" 1310 | } 1311 | 1312 | } 1313 | , { 1314 | "box" : { 1315 | "id" : "obj-10", 1316 | "maxclass" : "message", 1317 | "numinlets" : 2, 1318 | "numoutlets" : 1, 1319 | "outlettype" : [ "" ], 1320 | "patching_rect" : [ 212.0, 423.0, 79.0, 22.0 ], 1321 | "style" : "", 1322 | "text" : "/pitft connect" 1323 | } 1324 | 1325 | } 1326 | , { 1327 | "box" : { 1328 | "id" : "obj-1", 1329 | "maxclass" : "newobj", 1330 | "numinlets" : 1, 1331 | "numoutlets" : 2, 1332 | "outlettype" : [ "float", "bang" ], 1333 | "patching_rect" : [ 442.0, 76.0, 91.0, 22.0 ], 1334 | "style" : "", 1335 | "text" : "buffer~ sound1" 1336 | } 1337 | 1338 | } 1339 | , { 1340 | "box" : { 1341 | "id" : "obj-35", 1342 | "maxclass" : "gain~", 1343 | "numinlets" : 1, 1344 | "numoutlets" : 2, 1345 | "outlettype" : [ "signal", "int" ], 1346 | "parameter_enable" : 0, 1347 | "patching_rect" : [ 22.75, 254.0, 34.0, 89.0 ], 1348 | "style" : "" 1349 | } 1350 | 1351 | } 1352 | , { 1353 | "box" : { 1354 | "id" : "obj-31", 1355 | "maxclass" : "ezdac~", 1356 | "numinlets" : 2, 1357 | "numoutlets" : 0, 1358 | "patching_rect" : [ 17.25, 356.0, 45.0, 45.0 ], 1359 | "style" : "" 1360 | } 1361 | 1362 | } 1363 | , { 1364 | "box" : { 1365 | "id" : "obj-8", 1366 | "maxclass" : "newobj", 1367 | "numinlets" : 2, 1368 | "numoutlets" : 2, 1369 | "outlettype" : [ "", "" ], 1370 | "patching_rect" : [ 22.75, 93.0, 149.0, 22.0 ], 1371 | "saved_object_attributes" : { 1372 | "filename" : "oscroute.js", 1373 | "parameter_enable" : 0 1374 | } 1375 | , 1376 | "style" : "", 1377 | "text" : "js oscroute.js /pitft/sample" 1378 | } 1379 | 1380 | } 1381 | , { 1382 | "box" : { 1383 | "id" : "obj-17", 1384 | "linecount" : 3, 1385 | "maxclass" : "comment", 1386 | "numinlets" : 1, 1387 | "numoutlets" : 0, 1388 | "patching_rect" : [ 535.5, 528.0, 264.0, 47.0 ], 1389 | "style" : "", 1390 | "text" : "the oscroute.js helper script was created by James Drake and can be found here:\nhttp://monome.org/docs/app:oscroute" 1391 | } 1392 | 1393 | } 1394 | , { 1395 | "box" : { 1396 | "fontsize" : 16.0, 1397 | "id" : "obj-16", 1398 | "maxclass" : "comment", 1399 | "numinlets" : 1, 1400 | "numoutlets" : 0, 1401 | "patching_rect" : [ 227.0, 31.0, 102.0, 24.0 ], 1402 | "style" : "", 1403 | "text" : "SEND" 1404 | } 1405 | 1406 | } 1407 | , { 1408 | "box" : { 1409 | "fontsize" : 16.0, 1410 | "id" : "obj-15", 1411 | "maxclass" : "comment", 1412 | "numinlets" : 1, 1413 | "numoutlets" : 0, 1414 | "patching_rect" : [ 22.75, 23.0, 102.0, 24.0 ], 1415 | "style" : "", 1416 | "text" : "RECEIVE" 1417 | } 1418 | 1419 | } 1420 | , { 1421 | "box" : { 1422 | "id" : "obj-2", 1423 | "linecount" : 5, 1424 | "maxclass" : "comment", 1425 | "numinlets" : 1, 1426 | "numoutlets" : 0, 1427 | "patching_rect" : [ 420.0, 411.5, 149.0, 74.0 ], 1428 | "style" : "", 1429 | "text" : "you can change the destination address to whatever IP address or hostname you would like to send to" 1430 | } 1431 | 1432 | } 1433 | , { 1434 | "box" : { 1435 | "fontface" : 0, 1436 | "fontname" : "Arial", 1437 | "fontsize" : 13.0, 1438 | "id" : "obj-22", 1439 | "maxclass" : "newobj", 1440 | "numinlets" : 1, 1441 | "numoutlets" : 1, 1442 | "outlettype" : [ "" ], 1443 | "patching_rect" : [ 22.75, 56.0, 107.0, 23.0 ], 1444 | "style" : "", 1445 | "text" : "udpreceive 9999" 1446 | } 1447 | 1448 | } 1449 | , { 1450 | "box" : { 1451 | "fontface" : 0, 1452 | "fontname" : "Arial", 1453 | "fontsize" : 13.0, 1454 | "id" : "obj-24", 1455 | "maxclass" : "newobj", 1456 | "numinlets" : 1, 1457 | "numoutlets" : 0, 1458 | "patching_rect" : [ 212.0, 462.5, 150.0, 23.0 ], 1459 | "style" : "", 1460 | "text" : "udpsend 10.0.1.11 9998" 1461 | } 1462 | 1463 | } 1464 | ], 1465 | "lines" : [ { 1466 | "patchline" : { 1467 | "destination" : [ "obj-24", 0 ], 1468 | "disabled" : 0, 1469 | "hidden" : 0, 1470 | "midpoints" : [ 221.5, 447.0, 221.5, 447.0 ], 1471 | "source" : [ "obj-10", 0 ] 1472 | } 1473 | 1474 | } 1475 | , { 1476 | "patchline" : { 1477 | "destination" : [ "obj-1", 0 ], 1478 | "disabled" : 0, 1479 | "hidden" : 0, 1480 | "midpoints" : [ 376.5, 108.0, 438.0, 108.0, 438.0, 72.0, 451.5, 72.0 ], 1481 | "source" : [ "obj-13", 0 ] 1482 | } 1483 | 1484 | } 1485 | , { 1486 | "patchline" : { 1487 | "destination" : [ "obj-24", 0 ], 1488 | "disabled" : 0, 1489 | "hidden" : 0, 1490 | "midpoints" : [ 319.5, 447.0, 221.5, 447.0 ], 1491 | "source" : [ "obj-14", 0 ] 1492 | } 1493 | 1494 | } 1495 | , { 1496 | "patchline" : { 1497 | "destination" : [ "obj-35", 0 ], 1498 | "disabled" : 0, 1499 | "hidden" : 0, 1500 | "source" : [ "obj-18", 1 ] 1501 | } 1502 | 1503 | } 1504 | , { 1505 | "patchline" : { 1506 | "destination" : [ "obj-35", 0 ], 1507 | "disabled" : 0, 1508 | "hidden" : 0, 1509 | "source" : [ "obj-18", 0 ] 1510 | } 1511 | 1512 | } 1513 | , { 1514 | "patchline" : { 1515 | "destination" : [ "obj-14", 0 ], 1516 | "disabled" : 0, 1517 | "hidden" : 0, 1518 | "midpoints" : [ 621.5, 231.0, 435.0, 231.0, 435.0, 396.0, 319.5, 396.0 ], 1519 | "source" : [ "obj-19", 0 ] 1520 | } 1521 | 1522 | } 1523 | , { 1524 | "patchline" : { 1525 | "destination" : [ "obj-19", 0 ], 1526 | "disabled" : 0, 1527 | "hidden" : 0, 1528 | "midpoints" : [ 552.5, 192.0, 609.0, 192.0, 609.0, 156.0, 621.5, 156.0 ], 1529 | "source" : [ "obj-20", 0 ] 1530 | } 1531 | 1532 | } 1533 | , { 1534 | "patchline" : { 1535 | "destination" : [ "obj-19", 0 ], 1536 | "disabled" : 0, 1537 | "hidden" : 0, 1538 | "midpoints" : [ 376.5, 147.0, 618.0, 147.0, 618.0, 153.0, 621.5, 153.0 ], 1539 | "source" : [ "obj-21", 0 ] 1540 | } 1541 | 1542 | } 1543 | , { 1544 | "patchline" : { 1545 | "destination" : [ "obj-26", 0 ], 1546 | "disabled" : 0, 1547 | "hidden" : 0, 1548 | "source" : [ "obj-21", 0 ] 1549 | } 1550 | 1551 | } 1552 | , { 1553 | "patchline" : { 1554 | "destination" : [ "obj-8", 0 ], 1555 | "disabled" : 0, 1556 | "hidden" : 0, 1557 | "midpoints" : [ 32.25, 99.0, 32.25, 99.0 ], 1558 | "source" : [ "obj-22", 0 ] 1559 | } 1560 | 1561 | } 1562 | , { 1563 | "patchline" : { 1564 | "destination" : [ "obj-20", 0 ], 1565 | "disabled" : 0, 1566 | "hidden" : 0, 1567 | "midpoints" : [ 230.5, 196.0, 540.0, 196.0, 540.0, 155.0, 552.5, 155.0 ], 1568 | "source" : [ "obj-25", 0 ] 1569 | } 1570 | 1571 | } 1572 | , { 1573 | "patchline" : { 1574 | "destination" : [ "obj-26", 0 ], 1575 | "disabled" : 0, 1576 | "hidden" : 0, 1577 | "midpoints" : [ 230.5, 182.0, 207.0, 182.0, 207.0, 146.0, 376.5, 146.0 ], 1578 | "source" : [ "obj-25", 0 ] 1579 | } 1580 | 1581 | } 1582 | , { 1583 | "patchline" : { 1584 | "destination" : [ "obj-27", 0 ], 1585 | "disabled" : 0, 1586 | "hidden" : 0, 1587 | "midpoints" : [ 376.5, 191.0, 438.0, 191.0, 438.0, 155.0, 451.5, 155.0 ], 1588 | "source" : [ "obj-26", 0 ] 1589 | } 1590 | 1591 | } 1592 | , { 1593 | "patchline" : { 1594 | "destination" : [ "obj-14", 0 ], 1595 | "disabled" : 0, 1596 | "hidden" : 0, 1597 | "midpoints" : [ 621.5, 318.0, 435.0, 318.0, 435.0, 396.0, 319.5, 396.0 ], 1598 | "source" : [ "obj-28", 0 ] 1599 | } 1600 | 1601 | } 1602 | , { 1603 | "patchline" : { 1604 | "destination" : [ "obj-28", 0 ], 1605 | "disabled" : 0, 1606 | "hidden" : 0, 1607 | "midpoints" : [ 552.5, 279.0, 609.0, 279.0, 609.0, 243.0, 621.5, 243.0 ], 1608 | "source" : [ "obj-29", 0 ] 1609 | } 1610 | 1611 | } 1612 | , { 1613 | "patchline" : { 1614 | "destination" : [ "obj-14", 0 ], 1615 | "disabled" : 0, 1616 | "hidden" : 0, 1617 | "midpoints" : [ 621.5, 144.0, 435.0, 144.0, 435.0, 396.0, 319.5, 396.0 ], 1618 | "source" : [ "obj-3", 0 ] 1619 | } 1620 | 1621 | } 1622 | , { 1623 | "patchline" : { 1624 | "destination" : [ "obj-28", 0 ], 1625 | "disabled" : 0, 1626 | "hidden" : 0, 1627 | "midpoints" : [ 376.5, 234.0, 618.0, 234.0, 618.0, 240.0, 621.5, 240.0 ], 1628 | "source" : [ "obj-30", 0 ] 1629 | } 1630 | 1631 | } 1632 | , { 1633 | "patchline" : { 1634 | "destination" : [ "obj-36", 0 ], 1635 | "disabled" : 0, 1636 | "hidden" : 0, 1637 | "source" : [ "obj-30", 0 ] 1638 | } 1639 | 1640 | } 1641 | , { 1642 | "patchline" : { 1643 | "destination" : [ "obj-29", 0 ], 1644 | "disabled" : 0, 1645 | "hidden" : 0, 1646 | "midpoints" : [ 230.5, 278.0, 540.0, 278.0, 540.0, 242.0, 552.5, 242.0 ], 1647 | "source" : [ "obj-33", 0 ] 1648 | } 1649 | 1650 | } 1651 | , { 1652 | "patchline" : { 1653 | "destination" : [ "obj-36", 0 ], 1654 | "disabled" : 0, 1655 | "hidden" : 0, 1656 | "midpoints" : [ 230.5, 269.0, 207.0, 269.0, 207.0, 233.0, 376.5, 233.0 ], 1657 | "source" : [ "obj-33", 0 ] 1658 | } 1659 | 1660 | } 1661 | , { 1662 | "patchline" : { 1663 | "destination" : [ "obj-21", 0 ], 1664 | "disabled" : 0, 1665 | "hidden" : 0, 1666 | "midpoints" : [ 647.0, 63.0, 435.0, 63.0, 435.0, 108.0, 376.5, 108.0 ], 1667 | "source" : [ "obj-34", 0 ] 1668 | } 1669 | 1670 | } 1671 | , { 1672 | "patchline" : { 1673 | "destination" : [ "obj-30", 0 ], 1674 | "disabled" : 0, 1675 | "hidden" : 0, 1676 | "midpoints" : [ 647.0, 63.0, 687.0, 63.0, 687.0, 195.0, 376.5, 195.0 ], 1677 | "source" : [ "obj-34", 0 ] 1678 | } 1679 | 1680 | } 1681 | , { 1682 | "patchline" : { 1683 | "destination" : [ "obj-4", 0 ], 1684 | "disabled" : 0, 1685 | "hidden" : 0, 1686 | "midpoints" : [ 647.0, 24.0, 376.5, 24.0 ], 1687 | "source" : [ "obj-34", 0 ] 1688 | } 1689 | 1690 | } 1691 | , { 1692 | "patchline" : { 1693 | "destination" : [ "obj-40", 0 ], 1694 | "disabled" : 0, 1695 | "hidden" : 0, 1696 | "midpoints" : [ 647.0, 63.0, 687.0, 63.0, 687.0, 279.0, 376.5, 279.0 ], 1697 | "source" : [ "obj-34", 0 ] 1698 | } 1699 | 1700 | } 1701 | , { 1702 | "patchline" : { 1703 | "destination" : [ "obj-31", 1 ], 1704 | "disabled" : 0, 1705 | "hidden" : 0, 1706 | "source" : [ "obj-35", 0 ] 1707 | } 1708 | 1709 | } 1710 | , { 1711 | "patchline" : { 1712 | "destination" : [ "obj-31", 0 ], 1713 | "disabled" : 0, 1714 | "hidden" : 0, 1715 | "source" : [ "obj-35", 0 ] 1716 | } 1717 | 1718 | } 1719 | , { 1720 | "patchline" : { 1721 | "destination" : [ "obj-37", 0 ], 1722 | "disabled" : 0, 1723 | "hidden" : 0, 1724 | "midpoints" : [ 376.5, 278.0, 438.0, 278.0, 438.0, 242.0, 451.5, 242.0 ], 1725 | "source" : [ "obj-36", 0 ] 1726 | } 1727 | 1728 | } 1729 | , { 1730 | "patchline" : { 1731 | "destination" : [ "obj-14", 0 ], 1732 | "disabled" : 0, 1733 | "hidden" : 0, 1734 | "midpoints" : [ 621.5, 396.0, 319.5, 396.0 ], 1735 | "source" : [ "obj-38", 0 ] 1736 | } 1737 | 1738 | } 1739 | , { 1740 | "patchline" : { 1741 | "destination" : [ "obj-38", 0 ], 1742 | "disabled" : 0, 1743 | "hidden" : 0, 1744 | "midpoints" : [ 552.5, 364.0, 609.0, 364.0, 609.0, 328.0, 621.5, 328.0 ], 1745 | "source" : [ "obj-39", 0 ] 1746 | } 1747 | 1748 | } 1749 | , { 1750 | "patchline" : { 1751 | "destination" : [ "obj-13", 0 ], 1752 | "disabled" : 0, 1753 | "hidden" : 0, 1754 | "source" : [ "obj-4", 0 ] 1755 | } 1756 | 1757 | } 1758 | , { 1759 | "patchline" : { 1760 | "destination" : [ "obj-3", 0 ], 1761 | "disabled" : 0, 1762 | "hidden" : 0, 1763 | "midpoints" : [ 376.5, 63.0, 621.5, 63.0 ], 1764 | "source" : [ "obj-4", 0 ] 1765 | } 1766 | 1767 | } 1768 | , { 1769 | "patchline" : { 1770 | "destination" : [ "obj-38", 0 ], 1771 | "disabled" : 0, 1772 | "hidden" : 0, 1773 | "midpoints" : [ 376.5, 318.0, 621.5, 318.0 ], 1774 | "source" : [ "obj-40", 0 ] 1775 | } 1776 | 1777 | } 1778 | , { 1779 | "patchline" : { 1780 | "destination" : [ "obj-44", 0 ], 1781 | "disabled" : 0, 1782 | "hidden" : 0, 1783 | "source" : [ "obj-40", 0 ] 1784 | } 1785 | 1786 | } 1787 | , { 1788 | "patchline" : { 1789 | "destination" : [ "obj-3", 0 ], 1790 | "disabled" : 0, 1791 | "hidden" : 0, 1792 | "source" : [ "obj-41", 0 ] 1793 | } 1794 | 1795 | } 1796 | , { 1797 | "patchline" : { 1798 | "destination" : [ "obj-39", 0 ], 1799 | "disabled" : 0, 1800 | "hidden" : 0, 1801 | "midpoints" : [ 230.5, 363.0, 540.0, 363.0, 540.0, 327.0, 552.5, 327.0 ], 1802 | "source" : [ "obj-43", 0 ] 1803 | } 1804 | 1805 | } 1806 | , { 1807 | "patchline" : { 1808 | "destination" : [ "obj-44", 0 ], 1809 | "disabled" : 0, 1810 | "hidden" : 0, 1811 | "midpoints" : [ 230.5, 354.0, 207.0, 354.0, 207.0, 318.0, 376.5, 318.0 ], 1812 | "source" : [ "obj-43", 0 ] 1813 | } 1814 | 1815 | } 1816 | , { 1817 | "patchline" : { 1818 | "destination" : [ "obj-45", 0 ], 1819 | "disabled" : 0, 1820 | "hidden" : 0, 1821 | "midpoints" : [ 376.5, 363.0, 438.0, 363.0, 438.0, 327.0, 451.5, 327.0 ], 1822 | "source" : [ "obj-44", 0 ] 1823 | } 1824 | 1825 | } 1826 | , { 1827 | "patchline" : { 1828 | "destination" : [ "obj-21", 0 ], 1829 | "disabled" : 0, 1830 | "hidden" : 0, 1831 | "midpoints" : [ 717.5, 108.0, 376.5, 108.0 ], 1832 | "source" : [ "obj-46", 0 ] 1833 | } 1834 | 1835 | } 1836 | , { 1837 | "patchline" : { 1838 | "destination" : [ "obj-30", 0 ], 1839 | "disabled" : 0, 1840 | "hidden" : 0, 1841 | "midpoints" : [ 717.5, 195.0, 376.5, 195.0 ], 1842 | "source" : [ "obj-46", 0 ] 1843 | } 1844 | 1845 | } 1846 | , { 1847 | "patchline" : { 1848 | "destination" : [ "obj-4", 0 ], 1849 | "disabled" : 0, 1850 | "hidden" : 0, 1851 | "midpoints" : [ 717.5, 36.0, 426.0, 36.0, 426.0, 24.0, 376.5, 24.0 ], 1852 | "source" : [ "obj-46", 0 ] 1853 | } 1854 | 1855 | } 1856 | , { 1857 | "patchline" : { 1858 | "destination" : [ "obj-40", 0 ], 1859 | "disabled" : 0, 1860 | "hidden" : 0, 1861 | "midpoints" : [ 717.5, 279.0, 376.5, 279.0 ], 1862 | "source" : [ "obj-46", 0 ] 1863 | } 1864 | 1865 | } 1866 | , { 1867 | "patchline" : { 1868 | "destination" : [ "obj-35", 0 ], 1869 | "disabled" : 0, 1870 | "hidden" : 0, 1871 | "source" : [ "obj-48", 1 ] 1872 | } 1873 | 1874 | } 1875 | , { 1876 | "patchline" : { 1877 | "destination" : [ "obj-35", 0 ], 1878 | "disabled" : 0, 1879 | "hidden" : 0, 1880 | "source" : [ "obj-48", 0 ] 1881 | } 1882 | 1883 | } 1884 | , { 1885 | "patchline" : { 1886 | "destination" : [ "obj-35", 0 ], 1887 | "disabled" : 0, 1888 | "hidden" : 0, 1889 | "source" : [ "obj-49", 1 ] 1890 | } 1891 | 1892 | } 1893 | , { 1894 | "patchline" : { 1895 | "destination" : [ "obj-35", 0 ], 1896 | "disabled" : 0, 1897 | "hidden" : 0, 1898 | "source" : [ "obj-49", 0 ] 1899 | } 1900 | 1901 | } 1902 | , { 1903 | "patchline" : { 1904 | "destination" : [ "obj-13", 0 ], 1905 | "disabled" : 0, 1906 | "hidden" : 0, 1907 | "midpoints" : [ 230.5, 99.0, 207.0, 99.0, 207.0, 63.0, 376.5, 63.0 ], 1908 | "source" : [ "obj-5", 0 ] 1909 | } 1910 | 1911 | } 1912 | , { 1913 | "patchline" : { 1914 | "destination" : [ "obj-41", 0 ], 1915 | "disabled" : 0, 1916 | "hidden" : 0, 1917 | "midpoints" : [ 230.5, 108.0, 540.0, 108.0, 540.0, 72.0, 552.5, 72.0 ], 1918 | "source" : [ "obj-5", 0 ] 1919 | } 1920 | 1921 | } 1922 | , { 1923 | "patchline" : { 1924 | "destination" : [ "obj-35", 0 ], 1925 | "disabled" : 0, 1926 | "hidden" : 0, 1927 | "midpoints" : [ 136.25, 309.0, 66.0, 309.0, 66.0, 240.0, 32.25, 240.0 ], 1928 | "source" : [ "obj-50", 1 ] 1929 | } 1930 | 1931 | } 1932 | , { 1933 | "patchline" : { 1934 | "destination" : [ "obj-35", 0 ], 1935 | "disabled" : 0, 1936 | "hidden" : 0, 1937 | "source" : [ "obj-50", 0 ] 1938 | } 1939 | 1940 | } 1941 | , { 1942 | "patchline" : { 1943 | "destination" : [ "obj-18", 0 ], 1944 | "disabled" : 0, 1945 | "hidden" : 0, 1946 | "source" : [ "obj-53", 0 ] 1947 | } 1948 | 1949 | } 1950 | , { 1951 | "patchline" : { 1952 | "destination" : [ "obj-48", 0 ], 1953 | "disabled" : 0, 1954 | "hidden" : 0, 1955 | "source" : [ "obj-53", 1 ] 1956 | } 1957 | 1958 | } 1959 | , { 1960 | "patchline" : { 1961 | "destination" : [ "obj-49", 0 ], 1962 | "disabled" : 0, 1963 | "hidden" : 0, 1964 | "midpoints" : [ 76.25, 210.0, 102.25, 210.0 ], 1965 | "source" : [ "obj-53", 2 ] 1966 | } 1967 | 1968 | } 1969 | , { 1970 | "patchline" : { 1971 | "destination" : [ "obj-50", 0 ], 1972 | "disabled" : 0, 1973 | "hidden" : 0, 1974 | "midpoints" : [ 97.25, 168.0, 78.0, 168.0, 78.0, 261.0, 102.25, 261.0 ], 1975 | "source" : [ "obj-53", 3 ] 1976 | } 1977 | 1978 | } 1979 | , { 1980 | "patchline" : { 1981 | "destination" : [ "obj-53", 0 ], 1982 | "disabled" : 0, 1983 | "hidden" : 0, 1984 | "source" : [ "obj-8", 0 ] 1985 | } 1986 | 1987 | } 1988 | ], 1989 | "dependency_cache" : [ { 1990 | "name" : "oscroute.js", 1991 | "bootpath" : "~/adafruit-osc-guide/max", 1992 | "patcherrelativepath" : ".", 1993 | "type" : "TEXT", 1994 | "implicit" : 1 1995 | } 1996 | ], 1997 | "embedsnapshot" : 0 1998 | } 1999 | 2000 | } 2001 | -------------------------------------------------------------------------------- /max/pitft_sine.maxpat: -------------------------------------------------------------------------------- 1 | { 2 | "patcher" : { 3 | "fileversion" : 1, 4 | "appversion" : { 5 | "major" : 7, 6 | "minor" : 0, 7 | "revision" : 2, 8 | "architecture" : "x86", 9 | "modernui" : 1 10 | } 11 | , 12 | "rect" : [ 59.0, 104.0, 478.0, 565.0 ], 13 | "bglocked" : 0, 14 | "openinpresentation" : 0, 15 | "default_fontsize" : 12.0, 16 | "default_fontface" : 0, 17 | "default_fontname" : "Arial", 18 | "gridonopen" : 1, 19 | "gridsize" : [ 15.0, 15.0 ], 20 | "gridsnaponopen" : 1, 21 | "objectsnaponopen" : 1, 22 | "statusbarvisible" : 2, 23 | "toolbarvisible" : 1, 24 | "lefttoolbarpinned" : 0, 25 | "toptoolbarpinned" : 0, 26 | "righttoolbarpinned" : 0, 27 | "bottomtoolbarpinned" : 0, 28 | "toolbars_unpinned_last_save" : 0, 29 | "tallnewobj" : 0, 30 | "boxanimatetime" : 200, 31 | "enablehscroll" : 1, 32 | "enablevscroll" : 1, 33 | "devicewidth" : 0.0, 34 | "description" : "", 35 | "digest" : "", 36 | "tags" : "", 37 | "style" : "", 38 | "subpatcher_template" : "", 39 | "boxes" : [ { 40 | "box" : { 41 | "id" : "obj-35", 42 | "maxclass" : "gain~", 43 | "numinlets" : 1, 44 | "numoutlets" : 2, 45 | "outlettype" : [ "signal", "int" ], 46 | "parameter_enable" : 0, 47 | "patching_rect" : [ 269.25, 330.0, 34.0, 89.0 ], 48 | "style" : "" 49 | } 50 | 51 | } 52 | , { 53 | "box" : { 54 | "id" : "obj-31", 55 | "maxclass" : "ezdac~", 56 | "numinlets" : 2, 57 | "numoutlets" : 0, 58 | "patching_rect" : [ 263.75, 432.0, 45.0, 45.0 ], 59 | "style" : "" 60 | } 61 | 62 | } 63 | , { 64 | "box" : { 65 | "id" : "obj-30", 66 | "maxclass" : "newobj", 67 | "numinlets" : 2, 68 | "numoutlets" : 1, 69 | "outlettype" : [ "signal" ], 70 | "patching_rect" : [ 269.25, 288.0, 36.0, 22.0 ], 71 | "style" : "", 72 | "text" : "*~ 0." 73 | } 74 | 75 | } 76 | , { 77 | "box" : { 78 | "id" : "obj-29", 79 | "maxclass" : "newobj", 80 | "numinlets" : 2, 81 | "numoutlets" : 1, 82 | "outlettype" : [ "float" ], 83 | "patching_rect" : [ 349.25, 244.0, 41.0, 22.0 ], 84 | "style" : "", 85 | "text" : "/ 128." 86 | } 87 | 88 | } 89 | , { 90 | "box" : { 91 | "id" : "obj-28", 92 | "maxclass" : "newobj", 93 | "numinlets" : 2, 94 | "numoutlets" : 1, 95 | "outlettype" : [ "signal" ], 96 | "patching_rect" : [ 269.25, 244.0, 68.0, 22.0 ], 97 | "style" : "", 98 | "text" : "cycle~ 440" 99 | } 100 | 101 | } 102 | , { 103 | "box" : { 104 | "id" : "obj-27", 105 | "maxclass" : "newobj", 106 | "numinlets" : 1, 107 | "numoutlets" : 1, 108 | "outlettype" : [ "" ], 109 | "patching_rect" : [ 266.75, 207.0, 34.0, 22.0 ], 110 | "style" : "", 111 | "text" : "mtof" 112 | } 113 | 114 | } 115 | , { 116 | "box" : { 117 | "id" : "obj-21", 118 | "maxclass" : "number", 119 | "numinlets" : 1, 120 | "numoutlets" : 2, 121 | "outlettype" : [ "", "bang" ], 122 | "parameter_enable" : 0, 123 | "patching_rect" : [ 328.25, 168.0, 50.0, 22.0 ], 124 | "style" : "" 125 | } 126 | 127 | } 128 | , { 129 | "box" : { 130 | "id" : "obj-23", 131 | "maxclass" : "number", 132 | "numinlets" : 1, 133 | "numoutlets" : 2, 134 | "outlettype" : [ "", "bang" ], 135 | "parameter_enable" : 0, 136 | "patching_rect" : [ 266.75, 168.0, 50.0, 22.0 ], 137 | "style" : "" 138 | } 139 | 140 | } 141 | , { 142 | "box" : { 143 | "id" : "obj-25", 144 | "maxclass" : "newobj", 145 | "numinlets" : 1, 146 | "numoutlets" : 2, 147 | "outlettype" : [ "int", "int" ], 148 | "patching_rect" : [ 266.75, 130.0, 69.0, 22.0 ], 149 | "style" : "", 150 | "text" : "unpack 0 0" 151 | } 152 | 153 | } 154 | , { 155 | "box" : { 156 | "id" : "obj-8", 157 | "maxclass" : "newobj", 158 | "numinlets" : 2, 159 | "numoutlets" : 2, 160 | "outlettype" : [ "", "" ], 161 | "patching_rect" : [ 266.75, 95.0, 132.0, 22.0 ], 162 | "saved_object_attributes" : { 163 | "filename" : "oscroute.js", 164 | "parameter_enable" : 0 165 | } 166 | , 167 | "style" : "", 168 | "text" : "js oscroute.js /pitft/sine" 169 | } 170 | 171 | } 172 | , { 173 | "box" : { 174 | "id" : "obj-17", 175 | "linecount" : 3, 176 | "maxclass" : "comment", 177 | "numinlets" : 1, 178 | "numoutlets" : 0, 179 | "patching_rect" : [ 207.25, 508.0, 264.0, 47.0 ], 180 | "style" : "", 181 | "text" : "the oscroute.js helper script was created by James Drake and can be found here:\nhttp://monome.org/docs/app:oscroute" 182 | } 183 | 184 | } 185 | , { 186 | "box" : { 187 | "fontsize" : 16.0, 188 | "id" : "obj-16", 189 | "maxclass" : "comment", 190 | "numinlets" : 1, 191 | "numoutlets" : 0, 192 | "patching_rect" : [ 49.0, 32.0, 102.0, 24.0 ], 193 | "style" : "", 194 | "text" : "SEND" 195 | } 196 | 197 | } 198 | , { 199 | "box" : { 200 | "fontsize" : 16.0, 201 | "id" : "obj-15", 202 | "maxclass" : "comment", 203 | "numinlets" : 1, 204 | "numoutlets" : 0, 205 | "patching_rect" : [ 266.75, 25.0, 102.0, 24.0 ], 206 | "style" : "", 207 | "text" : "RECEIVE" 208 | } 209 | 210 | } 211 | , { 212 | "box" : { 213 | "id" : "obj-2", 214 | "linecount" : 5, 215 | "maxclass" : "comment", 216 | "numinlets" : 1, 217 | "numoutlets" : 0, 218 | "patching_rect" : [ 48.0, 146.0, 149.0, 74.0 ], 219 | "style" : "", 220 | "text" : "you can change the destination address to whatever IP address or hostname you would like to send to" 221 | } 222 | 223 | } 224 | , { 225 | "box" : { 226 | "fontname" : "Arial", 227 | "fontsize" : 13.0, 228 | "id" : "obj-6", 229 | "maxclass" : "message", 230 | "numinlets" : 2, 231 | "numoutlets" : 1, 232 | "outlettype" : [ "" ], 233 | "patching_rect" : [ 49.0, 75.0, 84.0, 23.0 ], 234 | "style" : "", 235 | "text" : "/pitft connect" 236 | } 237 | 238 | } 239 | , { 240 | "box" : { 241 | "fontface" : 0, 242 | "fontname" : "Arial", 243 | "fontsize" : 13.0, 244 | "id" : "obj-22", 245 | "maxclass" : "newobj", 246 | "numinlets" : 1, 247 | "numoutlets" : 1, 248 | "outlettype" : [ "" ], 249 | "patching_rect" : [ 266.75, 58.0, 107.0, 23.0 ], 250 | "style" : "", 251 | "text" : "udpreceive 9999" 252 | } 253 | 254 | } 255 | , { 256 | "box" : { 257 | "fontface" : 0, 258 | "fontname" : "Arial", 259 | "fontsize" : 13.0, 260 | "id" : "obj-24", 261 | "maxclass" : "newobj", 262 | "numinlets" : 1, 263 | "numoutlets" : 0, 264 | "patching_rect" : [ 49.0, 115.0, 150.0, 23.0 ], 265 | "style" : "", 266 | "text" : "udpsend 10.0.1.11 9998" 267 | } 268 | 269 | } 270 | ], 271 | "lines" : [ { 272 | "patchline" : { 273 | "destination" : [ "obj-29", 0 ], 274 | "disabled" : 0, 275 | "hidden" : 0, 276 | "midpoints" : [ 337.75, 230.0, 358.75, 230.0 ], 277 | "source" : [ "obj-21", 0 ] 278 | } 279 | 280 | } 281 | , { 282 | "patchline" : { 283 | "destination" : [ "obj-8", 0 ], 284 | "disabled" : 0, 285 | "hidden" : 0, 286 | "midpoints" : [ 276.25, 101.0, 276.25, 101.0 ], 287 | "source" : [ "obj-22", 0 ] 288 | } 289 | 290 | } 291 | , { 292 | "patchline" : { 293 | "destination" : [ "obj-27", 0 ], 294 | "disabled" : 0, 295 | "hidden" : 0, 296 | "source" : [ "obj-23", 0 ] 297 | } 298 | 299 | } 300 | , { 301 | "patchline" : { 302 | "destination" : [ "obj-21", 0 ], 303 | "disabled" : 0, 304 | "hidden" : 0, 305 | "midpoints" : [ 326.25, 164.0, 337.75, 164.0 ], 306 | "source" : [ "obj-25", 1 ] 307 | } 308 | 309 | } 310 | , { 311 | "patchline" : { 312 | "destination" : [ "obj-23", 0 ], 313 | "disabled" : 0, 314 | "hidden" : 0, 315 | "source" : [ "obj-25", 0 ] 316 | } 317 | 318 | } 319 | , { 320 | "patchline" : { 321 | "destination" : [ "obj-27", 0 ], 322 | "disabled" : 0, 323 | "hidden" : 0, 324 | "midpoints" : [ 276.25, 155.0, 251.0, 155.0, 251.0, 203.0, 276.25, 203.0 ], 325 | "source" : [ "obj-25", 0 ] 326 | } 327 | 328 | } 329 | , { 330 | "patchline" : { 331 | "destination" : [ "obj-28", 0 ], 332 | "disabled" : 0, 333 | "hidden" : 0, 334 | "source" : [ "obj-27", 0 ] 335 | } 336 | 337 | } 338 | , { 339 | "patchline" : { 340 | "destination" : [ "obj-30", 0 ], 341 | "disabled" : 0, 342 | "hidden" : 0, 343 | "source" : [ "obj-28", 0 ] 344 | } 345 | 346 | } 347 | , { 348 | "patchline" : { 349 | "destination" : [ "obj-30", 1 ], 350 | "disabled" : 0, 351 | "hidden" : 0, 352 | "source" : [ "obj-29", 0 ] 353 | } 354 | 355 | } 356 | , { 357 | "patchline" : { 358 | "destination" : [ "obj-35", 0 ], 359 | "disabled" : 0, 360 | "hidden" : 0, 361 | "midpoints" : [ 278.75, 320.0, 278.75, 320.0 ], 362 | "source" : [ "obj-30", 0 ] 363 | } 364 | 365 | } 366 | , { 367 | "patchline" : { 368 | "destination" : [ "obj-31", 1 ], 369 | "disabled" : 0, 370 | "hidden" : 0, 371 | "source" : [ "obj-35", 0 ] 372 | } 373 | 374 | } 375 | , { 376 | "patchline" : { 377 | "destination" : [ "obj-31", 0 ], 378 | "disabled" : 0, 379 | "hidden" : 0, 380 | "source" : [ "obj-35", 0 ] 381 | } 382 | 383 | } 384 | , { 385 | "patchline" : { 386 | "destination" : [ "obj-24", 0 ], 387 | "disabled" : 0, 388 | "hidden" : 0, 389 | "midpoints" : [ 58.5, 100.0, 58.5, 100.0 ], 390 | "source" : [ "obj-6", 0 ] 391 | } 392 | 393 | } 394 | , { 395 | "patchline" : { 396 | "destination" : [ "obj-25", 0 ], 397 | "disabled" : 0, 398 | "hidden" : 0, 399 | "source" : [ "obj-8", 0 ] 400 | } 401 | 402 | } 403 | ], 404 | "dependency_cache" : [ { 405 | "name" : "oscroute.js", 406 | "bootpath" : "~/adafruit-osc-guide/max", 407 | "patcherrelativepath" : ".", 408 | "type" : "TEXT", 409 | "implicit" : 1 410 | } 411 | ], 412 | "embedsnapshot" : 0 413 | } 414 | 415 | } 416 | -------------------------------------------------------------------------------- /max/snare.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/max/snare.aif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "osc-examples", 3 | "version": "1.0.0", 4 | "description": "A simple set of scripts for demonstrating OSC communication", 5 | "main": "print.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/toddtreece/osc-examples" 12 | }, 13 | "keywords": [ 14 | "osc" 15 | ], 16 | "author": "Todd Treece ", 17 | "license": "MIT", 18 | "bugs": { 19 | "url": "https://github.com/toddtreece/osc-examples/issues" 20 | }, 21 | "homepage": "https://github.com/toddtreece/osc-examples", 22 | "dependencies": { 23 | "osc-min": "^0.2.0", 24 | "socket.io": "^1.3.5" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /pd/clave.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/pd/clave.aif -------------------------------------------------------------------------------- /pd/hat.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/pd/hat.aif -------------------------------------------------------------------------------- /pd/kick.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/pd/kick.aif -------------------------------------------------------------------------------- /pd/osc.pd: -------------------------------------------------------------------------------- 1 | #N canvas 249 37 825 356 10; 2 | #X declare -lib mrpeach; 3 | #X obj -107 25 unpackOSC; 4 | #X obj -547 -51 import mrpeach; 5 | #X obj -492 147 udpsend; 6 | #X msg -410 28 disconnect; 7 | #X obj -492 115 packOSC; 8 | #X msg -560 28 connect 127.0.0.1 9998; 9 | #X obj -107 -7 udpreceive 9999; 10 | #X obj -220 99 routeOSC /many; 11 | #X obj -107 89 routeOSC /x; 12 | #X obj 0 99 routeOSC /y; 13 | #X obj -107 121 print x; 14 | #X obj 0 131 print y; 15 | #X obj -298 205 print arg1; 16 | #X obj -221 196 print arg2; 17 | #X obj -142 205 print arg3; 18 | #X obj -221 164 unpack s f 0; 19 | #X text -564 1 SENDING; 20 | #X text -109 -30 RECEIVING; 21 | #X msg -411 65 /socketio 25 25; 22 | #X msg -551 66 /print/pd hello 2 2.3; 23 | #X obj -107 57 routeOSC /print; 24 | #X obj 102 52 routeOSC /socketio; 25 | #X obj 102 86 unpack 0 0; 26 | #X obj 102 126 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 27 | -262144 -1 -1 0 256; 28 | #X obj 168 126 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 29 | -262144 -1 -1 0 256; 30 | #X connect 0 0 20 0; 31 | #X connect 0 0 21 0; 32 | #X connect 3 0 2 0; 33 | #X connect 4 0 2 0; 34 | #X connect 5 0 2 0; 35 | #X connect 6 0 0 0; 36 | #X connect 7 0 15 0; 37 | #X connect 8 0 10 0; 38 | #X connect 9 0 11 0; 39 | #X connect 15 0 12 0; 40 | #X connect 15 1 13 0; 41 | #X connect 15 2 14 0; 42 | #X connect 18 0 4 0; 43 | #X connect 19 0 4 0; 44 | #X connect 20 0 7 0; 45 | #X connect 20 0 8 0; 46 | #X connect 20 0 9 0; 47 | #X connect 21 0 22 0; 48 | #X connect 22 0 23 0; 49 | #X connect 22 1 24 0; 50 | -------------------------------------------------------------------------------- /pd/pitft_sample.pd: -------------------------------------------------------------------------------- 1 | #N canvas 0 22 820 688 10; 2 | #X declare -lib mrpeach; 3 | #X obj 68 207 loadbang; 4 | #X msg 467 161 bang; 5 | #X obj 467 193 delay 5; 6 | #X obj 63 367 soundfiler; 7 | #X obj 58 609 output~; 8 | #X text 948 761 updated for Pd version 0.37; 9 | #N canvas 0 22 450 300 (subpatch) 0; 10 | #X array sample1 176403 float 0; 11 | #X coords 0 1.02 176403 -1.02 200 130 1 0 0; 12 | #X restore 314 318 graph; 13 | #N canvas 0 22 450 300 (subpatch) 0; 14 | #X array sample2 176403 float 0; 15 | #X coords 0 1.02 176403 -1.02 200 130 1 0 0; 16 | #X restore 316 475 graph; 17 | #N canvas 0 22 450 300 (subpatch) 0; 18 | #X array sample3 176403 float 0; 19 | #X coords 0 1.02 176403 -1.02 200 130 1 0 0; 20 | #X restore 551 326 graph; 21 | #N canvas 0 22 450 300 (subpatch) 0; 22 | #X array sample4 176403 float 0; 23 | #X coords 0 1.02 176403 -1.02 200 130 1 0 0; 24 | #X restore 551 477 graph; 25 | #X obj 64 570 hip~ 5; 26 | #X obj 64 536 *~; 27 | #X obj 104 536 vline~; 28 | #X obj 64 454 vline~; 29 | #X obj 104 509 r cutoff; 30 | #X obj 64 424 r phase; 31 | #X obj 162 429 makefilename sample%d; 32 | #X msg 161 454 set \$1; 33 | #X msg 114 246 read kick.aif sample1; 34 | #X msg 114 307 read hat.aif sample3; 35 | #X obj 64 484 tabread4~ sample1; 36 | #X obj 465 73 unpackOSC; 37 | #X obj 653 619 import mrpeach; 38 | #X obj 105 112 udpsend; 39 | #X obj 105 80 packOSC; 40 | #X obj 464 47 udpreceive 9999; 41 | #X text 62 24 SENDING; 42 | #X text 462 24 RECEIVING; 43 | #X msg 174 75 /pitft/button 1 kick.aif; 44 | #X msg 66 51 connect 10.0.1.11 9998; 45 | #X msg 174 101 /pitft/button 2 snare.aif; 46 | #X msg 174 125 /pitft/button 3 hat.aif; 47 | #X msg 175 151 /pitft/button 4 clave.aif; 48 | #X msg 114 276 read clave.aif sample4; 49 | #X msg 115 335 read snare.aif sample2; 50 | #X obj 467 107 routeOSC /pitft/sample; 51 | #X msg 533 226 \; phase 1 \, 4.41e+08 1e+07 \; cutoff 1; 52 | #X msg 449 236 \; cutoff 0 5; 53 | #X obj 162 400 r samplename; 54 | #X obj 532 160 s samplename; 55 | #X connect 0 0 18 0; 56 | #X connect 0 0 33 0; 57 | #X connect 0 0 19 0; 58 | #X connect 0 0 34 0; 59 | #X connect 1 0 2 0; 60 | #X connect 1 0 37 0; 61 | #X connect 2 0 36 0; 62 | #X connect 10 0 4 0; 63 | #X connect 10 0 4 1; 64 | #X connect 11 0 10 0; 65 | #X connect 12 0 11 1; 66 | #X connect 13 0 20 0; 67 | #X connect 14 0 12 0; 68 | #X connect 15 0 13 0; 69 | #X connect 16 0 17 0; 70 | #X connect 17 0 20 0; 71 | #X connect 18 0 3 0; 72 | #X connect 19 0 3 0; 73 | #X connect 20 0 11 0; 74 | #X connect 21 0 35 0; 75 | #X connect 23 0 28 0; 76 | #X connect 23 0 30 0; 77 | #X connect 23 0 31 0; 78 | #X connect 23 0 32 0; 79 | #X connect 24 0 23 0; 80 | #X connect 25 0 21 0; 81 | #X connect 28 0 24 0; 82 | #X connect 29 0 23 0; 83 | #X connect 30 0 24 0; 84 | #X connect 31 0 24 0; 85 | #X connect 32 0 24 0; 86 | #X connect 33 0 3 0; 87 | #X connect 34 0 3 0; 88 | #X connect 35 0 1 0; 89 | #X connect 35 0 39 0; 90 | #X connect 38 0 16 0; 91 | -------------------------------------------------------------------------------- /pd/pitft_sine.pd: -------------------------------------------------------------------------------- 1 | #N canvas 473 204 460 306 10; 2 | #X declare -lib mrpeach; 3 | #X obj 91 170 osc~ 440; 4 | #X obj 91 229 dac~; 5 | #X msg -194 178 \; pd dsp 1; 6 | #X msg -90 178 \; pd dsp 0; 7 | #X text -179 215 ON; 8 | #X text -70 215 OFF; 9 | #X obj 91 47 unpackOSC; 10 | #X obj 91 15 udpreceive 9999; 11 | #X text 89 -8 RECEIVING; 12 | #X obj 91 141 mtof; 13 | #X obj 91 79 routeOSC /pitft/sine; 14 | #X obj 91 109 unpack 0 0; 15 | #X obj 154 140 / 128; 16 | #X obj -193 244 import mrpeach; 17 | #X obj -109 85 udpsend; 18 | #X obj -110 52 packOSC; 19 | #X obj -194 146 loadbang; 20 | #X msg -48 18 /pitft connect; 21 | #X msg -200 18 connect 10.0.1.11 9998; 22 | #X text -95 -7 CONNECT; 23 | #X obj 91 199 *~ 0.05; 24 | #X obj 154 170 / 0.5; 25 | #X connect 0 0 20 0; 26 | #X connect 6 0 10 0; 27 | #X connect 7 0 6 0; 28 | #X connect 9 0 0 0; 29 | #X connect 10 0 11 0; 30 | #X connect 11 0 9 0; 31 | #X connect 11 1 12 0; 32 | #X connect 12 0 21 0; 33 | #X connect 15 0 14 0; 34 | #X connect 16 0 2 0; 35 | #X connect 17 0 15 0; 36 | #X connect 18 0 14 0; 37 | #X connect 20 0 1 0; 38 | #X connect 21 0 20 1; 39 | -------------------------------------------------------------------------------- /pd/snare.aif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/pd/snare.aif -------------------------------------------------------------------------------- /pitft/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toddtreece/osc-examples/a6122febc913cff1c9779536fa5133cb6450ddba/pitft/logo.png -------------------------------------------------------------------------------- /pitft/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "osc-pitft", 3 | "version": "1.0.0", 4 | "description": "An example demonstrating sending touch info via OSC", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/toddtreece/osc-examples" 12 | }, 13 | "keywords": [ 14 | "osc", 15 | "pitft", 16 | "raspberry", 17 | "pi" 18 | ], 19 | "author": "Todd Treece ", 20 | "license": "GPL v3", 21 | "bugs": { 22 | "url": "https://github.com/toddtreece/osc-examples/issues" 23 | }, 24 | "homepage": "https://github.com/toddtreece/osc-examples", 25 | "dependencies": { 26 | "osc-min": "^0.2.0", 27 | "pitft": "git://github.com/toddtreece/node-pitft", 28 | "pitft-touch": "git://github.com/toddtreece/node-pitft-touch#tslib" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pitft/sample.js: -------------------------------------------------------------------------------- 1 | var pitft = require('pitft'), 2 | touch = require('pitft-touch'), 3 | fb = pitft('/dev/fb1'), 4 | util = require('util'), 5 | xMax = fb.size().width, 6 | yMax = fb.size().height, 7 | osc = require('osc-min'), 8 | dgram = require('dgram'), 9 | remote; 10 | 11 | fb.clear(); 12 | 13 | var buttons = []; 14 | var button_tpl = { 15 | x: 0, 16 | y: 0, 17 | w: parseInt(xMax / 2), 18 | h: parseInt(yMax / 2), 19 | name: 'NOT SET', 20 | id: 0, 21 | pressed: false 22 | }; 23 | 24 | for(var i = 0; i < 2; i++) { 25 | 26 | for(var j = 0; j < 2; j++) { 27 | 28 | var btn = {}; 29 | util._extend(btn, button_tpl); 30 | 31 | btn.x = btn.w * j; 32 | btn.y = btn.h * i; 33 | btn.id = buttons.length; 34 | buttons.push(btn); 35 | 36 | } 37 | 38 | } 39 | 40 | 41 | // listen for OSC messages and print them to the console 42 | var udp = dgram.createSocket('udp4', function(msg, rinfo) { 43 | 44 | remote = rinfo.address; 45 | 46 | try { 47 | msg = osc.fromBuffer(msg); 48 | } catch(err) { 49 | return console.log('Could not decode OSC message'); 50 | } 51 | 52 | if(msg.address != '/pitft/button') 53 | return; 54 | 55 | buttons[msg.args[0].value - 1].name = msg.args[1].value; 56 | draw(); 57 | 58 | }); 59 | 60 | function send(id) { 61 | 62 | // we don't have the remote address yet 63 | if(! remote) 64 | return; 65 | 66 | if(isNaN(id)) 67 | return; 68 | 69 | var midi = osc.toBuffer({ 70 | oscType: 'message', 71 | address: '/pitft/sample', 72 | args: [{ 73 | type: 'integer', 74 | value: id + 1 75 | }] 76 | }); 77 | 78 | udp.send(midi, 0, midi.length, 9999, remote); 79 | 80 | } 81 | 82 | udp.bind(9998); 83 | console.log('Listening for OSC messages on port 9998'); 84 | console.log('Make sure to send connect message from example OSC patch'); 85 | 86 | var waiting; 87 | 88 | touch('/dev/input/touchscreen', function(err, data) { 89 | 90 | if(waiting) 91 | return; 92 | 93 | waiting = setTimeout(function() { clearInterval(waiting); waiting = null; }, 200); 94 | 95 | if(! data.touch) 96 | return; 97 | 98 | send(getId(data)); 99 | draw(data); 100 | setTimeout(draw, 200); 101 | 102 | }); 103 | 104 | 105 | function getId(data) { 106 | 107 | if(! data) 108 | return; 109 | 110 | for(var i = 0; i < buttons.length; i++) { 111 | 112 | var button = buttons[i]; 113 | 114 | if(data.x < button.x) 115 | continue; 116 | 117 | if(data.y < button.y) 118 | continue; 119 | 120 | if(data.x > button.x + button.w) 121 | continue; 122 | 123 | if(data.y > button.y + button.h) 124 | continue; 125 | 126 | return button.id; 127 | 128 | } 129 | 130 | } 131 | 132 | function draw(data) { 133 | 134 | var id = getId(data); 135 | 136 | for(var i = 0; i < buttons.length; i++) { 137 | 138 | var button = buttons[i]; 139 | 140 | if (button.id == id) 141 | fb.color(0, 1, 0); 142 | else 143 | fb.color(0, 0.8, 0); 144 | 145 | fb.rect(button.x, button.y, button.w, button.h, true); 146 | fb.color(0, 0, 0); 147 | fb.font('fantasy', 18, true); 148 | fb.line(xMax /2, 0, xMax / 2, yMax, 2); 149 | fb.line(0, yMax / 2, xMax, yMax / 2, 2); 150 | fb.text(button.x + button.w / 2, button.y + button.h / 2, button.name, true); 151 | 152 | } 153 | 154 | fb.blit(); 155 | 156 | } 157 | 158 | -------------------------------------------------------------------------------- /pitft/sine.js: -------------------------------------------------------------------------------- 1 | var pitft = require('pitft'), 2 | touch = require('pitft-touch'), 3 | fb = pitft('/dev/fb1', true), 4 | xMax = fb.size().width, 5 | yMax = fb.size().height, 6 | osc = require('osc-min'), 7 | dgram = require('dgram'), 8 | remote; 9 | 10 | fb.clear(); 11 | 12 | function s(value, fromMin, fromMax, toMin, toMax) { 13 | var percent = (value - fromMin) / (fromMax - fromMin); 14 | return (percent * (toMax - toMin) + toMin); 15 | } 16 | 17 | // listen for OSC messages and print them to the console 18 | var udp = dgram.createSocket('udp4', function(msg, rinfo) { 19 | remote = rinfo.address; 20 | fb.color(0, 0, 1); 21 | fb.rect(0, 0, xMax, yMax, true); 22 | fb.blit(); 23 | }); 24 | 25 | function send(x,y) { 26 | 27 | // we don't have the remote address yet 28 | if(! remote) 29 | return; 30 | 31 | x = s(x, 0, xMax, 30, 100); 32 | y = s(y, 0, yMax, 0, 127); 33 | 34 | // build message with a few different OSC args 35 | var midi = osc.toBuffer({ 36 | oscType: 'message', 37 | address: '/pitft/sine', 38 | args: [{ 39 | type: 'integer', 40 | value: x 41 | }, 42 | { 43 | type: 'integer', 44 | value: y 45 | }] 46 | }); 47 | 48 | udp.send(midi, 0, midi.length, 9999, remote); 49 | 50 | } 51 | 52 | udp.bind(9998); 53 | console.log('Listening for OSC messages on port 9998'); 54 | console.log('Make sure to send connect message from example OSC patch'); 55 | 56 | var waiting; 57 | touch('/dev/input/touchscreen', function(err, data) { 58 | 59 | send(data.x,data.y); 60 | 61 | if(waiting) 62 | return; 63 | 64 | waiting = setTimeout(function() { clearInterval(waiting); waiting = null; }, 100); 65 | 66 | fb.color(0, 0, 1); 67 | fb.rect(0, 0, xMax, yMax, true); 68 | fb.image(data.x - 80, data.y - 80, __dirname + '/logo.png'); 69 | fb.blit(); 70 | 71 | }); 72 | -------------------------------------------------------------------------------- /print.js: -------------------------------------------------------------------------------- 1 | var osc = require('osc-min'), 2 | dgram = require('dgram'), 3 | remote; 4 | 5 | // listen for OSC messages and print them to the console 6 | var udp = dgram.createSocket('udp4', function(msg, rinfo) { 7 | 8 | // save the remote address 9 | remote = rinfo.address; 10 | 11 | try { 12 | console.log(osc.fromBuffer(msg)); 13 | } catch (err) { 14 | console.log('Could not decode OSC message'); 15 | } 16 | 17 | }); 18 | 19 | // setinterval callback 20 | function send() { 21 | 22 | // we don't have the remote address yet 23 | if(! remote) 24 | return; 25 | 26 | // build message with a few different OSC args 27 | var many = osc.toBuffer({ 28 | oscType: 'message', 29 | address: '/print/many', 30 | args: [{ 31 | type: 'string', 32 | value: 'testing' 33 | }, 34 | { 35 | type: 'float', 36 | value: 3.14 37 | }, 38 | { 39 | type: 'integer', 40 | value: 200 41 | }] 42 | }); 43 | 44 | // build x message with single arg 45 | var x = osc.toBuffer({ 46 | oscType: 'message', 47 | address: '/print/x', 48 | args: [{ 49 | type: 'integer', 50 | value: 50 51 | }] 52 | }); 53 | 54 | // build y message with single arg 55 | var y = osc.toBuffer({ 56 | oscType: 'message', 57 | address: '/print/y', 58 | args: [{ 59 | type: 'integer', 60 | value: 20 61 | }] 62 | }); 63 | 64 | // send a bunch of args to the address that sent the last message to us 65 | udp.send(many, 0, many.length, 9999, remote); 66 | 67 | // send x and y messages 68 | udp.send(x, 0, x.length, 9999, remote); 69 | udp.send(y, 0, y.length, 9999, remote); 70 | 71 | console.log('Sent OSC message to %s:%d', remote, 9999); 72 | 73 | } 74 | 75 | // send message every second 76 | setInterval(send, 1000); 77 | 78 | udp.bind(9998); 79 | console.log('Listening for OSC messages on port 9998'); 80 | -------------------------------------------------------------------------------- /socketio.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | socket.io & osc example 6 | 7 | 8 | 9 | 10 |

socket.io & osc

11 | 12 | 13 | 14 | 15 | 16 |

Output:

17 | 18 |

19 | 
20 |     
39 | 
40 |   
41 | 
42 | 


--------------------------------------------------------------------------------
/socketio.js:
--------------------------------------------------------------------------------
 1 | var http = require('http'),
 2 |     socketio = require('socket.io'),
 3 |     fs = require('fs'),
 4 |     osc = require('osc-min'),
 5 |     dgram = require('dgram'),
 6 |     remote_osc_ip;
 7 | 
 8 | 
 9 | var http_server = http.createServer(function(req, res) {
10 | 
11 |   fs.readFile(__dirname + '/socketio.html', function(err, data) {
12 | 
13 |     if(err) {
14 |       res.writeHead(500);
15 |       return res.end('Error loading socket.io.html');
16 |     }
17 | 
18 |     res.writeHead(200);
19 |     res.end(data);
20 | 
21 |   });
22 | 
23 | });
24 | 
25 | var io = socketio(http_server);
26 | 
27 | var udp_server = dgram.createSocket('udp4', function(msg, rinfo) {
28 | 
29 |   var osc_message;
30 |   try {
31 |     osc_message = osc.fromBuffer(msg);
32 |   } catch(err) {
33 |     return console.log('Could not decode OSC message');
34 |   }
35 | 
36 |   if(osc_message.address != '/socketio') {
37 |     return console.log('Invalid OSC address');
38 |   }
39 | 
40 |   remote_osc_ip = rinfo.address;
41 | 
42 |   io.emit('osc', {
43 |     x: parseInt(osc_message.args[0].value) || 0,
44 |     y: parseInt(osc_message.args[1].value) || 0
45 |   });
46 | 
47 | });
48 | 
49 | io.on('connection', function(socket) {
50 | 
51 |   socket.on('browser', function(data) {
52 | 
53 |     if(! remote_osc_ip) {
54 |       return;
55 |     }
56 | 
57 |     var osc_msg = osc.toBuffer({
58 |       oscType: 'message',
59 |       address: '/socketio',
60 |       args:[{ 
61 |         type: 'integer',
62 |         value: parseInt(data.x) || 0
63 |       },
64 |       {
65 |         type: 'integer',
66 |         value: parseInt(data.y) || 0
67 |       }]
68 |     });
69 | 
70 |     udp_server.send(osc_msg, 0, osc_msg.length, 9999, remote_osc_ip);
71 |     console.log('Sent OSC message to %s:9999', remote_osc_ip);
72 | 
73 |   });
74 | 
75 | });
76 | 
77 | http_server.listen(8080);
78 | console.log('Starting HTTP server on TCP port 8080');
79 | udp_server.bind(9998);
80 | console.log('Starting UDP server on UDP port 9998');
81 | 
82 | 


--------------------------------------------------------------------------------