{
   "labels" : [
      "controller",
      "expert sleepers",
      "es5"
   ],
   "is_private" : null,
   "id" : "1-50f",
   "code" : "As I just got the ES3 and ES5. I post here some code to use the ES5 from\r\nexpert sleepers with sc maybe its interesting for somebody.\r\n\r\n(\r\n~es5_control={|channel,device,gate|\r\n     var shift=(2-device)*8;//to which device should the gate be shifted\r\n     var val=1<<channel<<shift;//to which channel should the gate be shifted\r\n     var on=if((0x800000&val)>0)//calculate the right float value\r\n     {Float.from32Bits(val) / (Float.from32Bits(0x800000) * -1)}\r\n     {Float.from32Bits(0xffffff&val) / Float.from32Bits(0x800000)};\r\n     if(gate>0,on,0);//output either the precalulated float or a 0\r\n};\r\n)\r\n\r\n//simple function to switch on the gates Silence is necessary to create\r\na Audio-Rate signal\r\n{Out.ar(0,Silence.ar+~es5_control.(0,0,1))}.play;//switch on first channel\r\n{Out.ar(0,Silence.ar+~es5_control.(3,0,1))}.play;//switch on fourth channel\r\n\r\n//contol gate 6 with a pulse oscilator\r\n{Out.ar(0,~es5_control.(5,0,LFPulse.ar(1,0)))}.play;\r\n\r\n(\r\n//test function for first adat channel\r\n{Out.ar(0,\r\n     (0..2).collect{|dev| //generate gates for all 3 devices per channel\r\n         (1/Array.geom(8,1,2)).collect{|item,chan|  //generate gates for\r\nall channels\r\n             ~es5_control.(chan,dev,LFPulse.ar(item,0)) //use a LFPulse\r\nto control the gates\r\n     }.sum}.sum) //summarise the different channels to send them to the\r\nfirst channel\r\n}.play;\r\n)",
   "name" : "expert sleepers ES-5 control code",
   "author" : "olaf",
   "ancestor_list" : [],
   "description" : ""
}
