{
   "name" : "Re: network of loosely connected nodes (now working)",
   "author" : "LFSaw",
   "ancestor_list" : [
      "1-4Tw"
   ],
   "description" : "Idea: network of loosely connected nodes. Each node has a dedicated pulse rate / phase. Inducing an irregular trigger signal influences the nodes to (gradually) adapt their pulsation freq (and phase?) to the one of the input.\r\nsound example: https://soundcloud.com/lfsaw/sync-weakconnection-tduty-time",
   "labels" : [
      "code fork",
      "synchronisation",
      "weak connection"
   ],
   "is_private" : null,
   "id" : "1-4Vb",
   "code" : "(\r\nNdef(\\nodeTest, {\r\n\t // the input\r\n//\tvar input = Impulse.ar([1, 3, 5].reciprocal * 1, phase: [0, 0.25, 0.5]).sum;\r\n\r\n\t//var input = Impulse.ar([2, 3], phase: [0, 0.25]).sum;\r\n//\tvar input = Select.ar(Line.kr(0, 1, 10) * SinOsc.ar(0.01).range(0, 1), [Impulse.ar([0.2, 0.3], phase: [0, 0.25]).sum, LocalIn.ar(1)]);\r\n\r\n\tvar input = Select.ar(Line.kr(0, 1, 10), [Impulse.ar(0.134), LocalIn.ar(1)]);\r\n\t// the nodes, each takes its predecessor as input and estimates the duration between two events.\r\n\tvar nodes = (1..20).inject([input], {|last, item|\r\n\t\tvar dur = Gate.ar(\r\n\t\t\tTimer.ar(TDelay.ar(last.first, Rand(1, 4))),\r\n\t\t\tlast.first\r\n\t\t);\r\n\r\n\t\t[TDuty.ar(\r\n\t\t\tdur.lag(20),\r\n\t\t\tTDelay.ar(last.first, dur.lag(20)),\r\n\t\t\t1\r\n\t\t)] ++ last\r\n\t});\r\n\r\n\r\n\tLocalOut.ar(nodes.first);\r\n\r\n\t// add a pitch to each\r\n\tnodes = nodes.collect{|node, i|  SinOsc.ar((500 + (i*250)), 0.9pi)\r\n//\t\t* Decay2.ar(node, 0.01, 0.2)\r\n\t\t* EnvGen.ar(Env.perc(0.0001, 0.1), gate: node)\r\n * 2 * (25-i) * 0.01};\r\n\r\n\t// splay in stereo field\r\n\t//nodes.sum!2;\r\n\tSplay.ar(nodes)// + (SinOsc.ar(2000) * Decay2.ar(input, 0.01, 0.2) * 0.1);\r\n\r\n}).play\r\n)"
}
