{
   "labels" : [
      "pattern",
      "osc",
      "renoise",
      "vsti"
   ],
   "code" : "// declare an event type which sends OSC commands to Renoise\r\n\r\n(\r\nEvent.addEventType(\\renoise, { |server|\r\n  var renoiseOscServer = NetAddr(\"127.0.0.1\", 8000);\r\n  var notes = [~midinote.value, ~ctranspose.value, ~velocity.value, ~sustain.value, ~lag.value, ~timingOffset.value, ~instr.value, ~track.value].flop;\r\n  var timeNoteOn, timeNoteOff, instrument, track, velocity;\r\n  var serverLatency;\r\n\r\n  serverLatency = server.latency ? 0;\r\n\r\n  notes.do {|note|\r\n    instrument = note[6] ? -1;\r\n    track = note[7] ? -1;\r\n    velocity = note[2].asInt.clip(0,127);\r\n\r\n    // sustain and timingOffset are in beats, lag is in seconds\r\n    timeNoteOn = (thisThread.clock.tempo.reciprocal*note[5])+note[4]+server.latency;\r\n    timeNoteOff = (thisThread.clock.tempo.reciprocal*(note[3]+note[5]))+note[4]+server.latency;\r\n    SystemClock.sched(timeNoteOn, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_on\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt, velocity )});\r\n    SystemClock.sched(timeNoteOff, {renoiseOscServer.sendMsg(\"/renoise/trigger/note_off\", instrument.asInt, track.asInt, (note[0]+note[1]).asInt)});\r\n  }\r\n});\r\n)\r\n\r\n// Now start Renoise OSC server, load a sample, and try some patterns\r\n\r\n// straight timing\r\n(\r\nPbind(*[\r\n  type: \\renoise,\r\n  legato: Pgauss(0.2,0.05,inf),\r\n  dur: 0.2,\r\n  degree: [2,5,12],\r\n  track: Prand([0,1], inf),\r\n  ctranspose: Pseq([0,0,0,0,4,4,4,4,5,5,5,5],inf),\r\n  velocity: Pgauss(64,10,inf),\r\n]).play;\r\n)\r\n\r\n// loose timing\r\n(\r\nPbind(*[\r\n  type: \\renoise,\r\n  legato: 0.1,\r\n  dur: 0.2,\r\n  midinote: [66, 69, 74],\r\n  lag: Pwhite(-0.05!3, 0.05)\r\n]).play;\r\n)",
   "id" : "1-4SN",
   "is_private" : null,
   "name" : "Supercollider to Renoise",
   "author" : "g_montel",
   "description" : "Renoise tracker (see renoise.com) can be controlled with OSC commands.\r\nWith this Renoise Event Type, you can easily generate some patterns which will be played by Renoise.\r\nUseful if you want to make patterns with VSTi :-)\r\n\r\nUsage :\r\n- start Renoise\r\n- in preferences, start OSC server\r\n- load a sample or VSTi in a sample slot in Renoise\r\n- start Supercollider\r\n- try this code\r\n- make more patterns !",
   "ancestor_list" : []
}
