{
   "labels" : [
      "theremin",
      "kinect",
      "nimate",
      "osc receiver"
   ],
   "id" : "1-4Wg",
   "is_private" : null,
   "code" : "//NIMate \"Full Skeleton\" Kinect Theremin\r\n\r\n//Start server\r\n\r\ns.boot;\r\n\r\n\r\n//Start buses and OSC receivers\r\n\r\nb=Bus.control(s,3);\r\nc=Bus.control(s,3);\r\n\r\n\r\nOSCdef.new(\r\n \\rh_xyz,\r\n {\r\n  |msg, time, addr, recvPort|\r\n  postln(msg);\r\n  b.setnSynchronous([msg[1],(msg[2]+1)/2,msg[3]+0.3]);\r\n },\r\n \"/Right_Hand\", nil, 7000\r\n);\r\n\r\n\r\nOSCdef.new(\r\n \\lh_xyz,\r\n {\r\n  |msg, time, addr, recvPort|\r\n  postln(msg);\r\n  c.setnSynchronous([msg[1]+0.9,(msg[2]+1)/2,msg[3]+0.3]);\r\n },\r\n \"/Left_Hand\", nil, 7000\r\n);\r\n\r\n\r\nOSCdef(\\lh_xyz).enable;\r\nOSCdef(\\rh_xyz).enable;\r\n\r\n\r\n//Synth definition and bus mapping\r\n\r\nSynthDef(\\theremin,\r\n {\r\n |ctrl=#[0,0,0], ctrr=#[0,0,0]|\r\n var f, a, vibrate, tremrate;\r\n\r\n f = LinExp.kr(ctrr[0],0,1,100,1000);\r\n vibrate = LinExp.kr(ctrl[0],0,1,1,500);\r\n tremrate = 100*ctrl[1];\r\n\r\n a = SinOsc.ar(f + (f *\r\n   SinOsc.ar(vibrate,0,0.1)),0,\r\n   mul: ctrr[1])*\r\n  SinOsc.kr(tremrate);\r\n\r\n Out.ar([0,1], a)\r\n    }).add;\r\n\r\nx=Synth.new(\\theremin);\r\n\r\nx.map(\\ctrr,b);\r\nx.map(\\ctrl,c);\r\n\r\n\r\n//Clean up\r\n\r\nx.free;\r\nb.free;\r\nc.free;\r\ns.stop;\r\ns.quit;",
   "author" : "rev",
   "name" : "Receiving NIMate generated OSC messages",
   "ancestor_list" : [],
   "description" : "Simple Theremin receiving OSC messages generated by NIMate via a MS Kinect.\r\nThe code is raw and contains arbitrary mapping. Works with \"Full Skeleton\" mode. Can be adapted to \"OSC control\" mode by changing \"/Right_hand\" and \"Left_Hand\" in the OSCDefs with the correct joint names. In that case You'd also need sigle channel buses.\r\nOSCDef and Bus definition and mapping could be of interest to whoever wants to map NIMate OSC to the SuperCollider."
}
