// the left neighbor:
l = NetAddr("200.0.0.13", 57120); // change the IP address!!,   57120 is sclang default port

// the right neighbor:
r = NetAddr("200.0.0.2", 57120); // change the IP address!!,   57120 is sclang default port

(
SynthDef("ping", { arg freq=300, dur=0.5, amp=1.0;
	var sig, env;
	env = EnvGen.kr(Env.perc(0.01, dur), doneAction: 2);
	sig = Pulse.ar(freq, env*0.5, env * amp);
	Out.ar(0, sig);
}).store;
)	

Synth("ping", nil, z)

//SinOsc.ar(300, 0, 1)
//SinOsc.ar(300, mul: 1)
//SinOsc.ar(phase: 0, mul: 0.4, freq: 349)

// the message format ["/game", <freq>, <dur>, <amp> ]

(
// always remove the responder before you change it!
o.remove;

// an OSC responder to receive from the left neighbor and to send to the right neighbor:
o = OSCresponder(l, '/game', 
		{ arg time, resp, msg; 
		var dur, freq, amp;
		("received from" + l.ip + ":\n\t" ).post;
		msg.postln;
		freq = msg[1];
		dur = msg[2];
		amp = msg[3];
		Synth("ping", [\freq, freq, \dur, dur, \amp,amp]);
		{ r.sendMsg("/game", 200, dur * rrand(1.0, 1.2), amp) }.defer(dur);
		}).add;
)

r
r.sendMsg("/game", rrand(100, 400), 0.5, rrand(0.5, 1.0))

{ "hello".postln }.defer(2)

OSCresponder.remove