Set a Synth param with MouseX

Hi, I want to quickly try some parameter changes on a synth while designing it. How can I get mouse coordinates to set its parameters?

I’m trying to do the following;

SynthDef(\t3, {
	|amp=0.1, pan=0, out=0, gate=1,p0=1, p1=1, p2=1, p3=1|
	var sig, env;
	sig = {*0.5)!2);*0.8 +1,1.98)),*200,2e3,x).lag(2),x.range(5e-4,1e-3),p3* 0.0012)};

	env =,gate,doneAction:2, levelScale:amp);,*env, pan));

a = Synth(\t3);
a.set(\p0, <a value from MouseX here>);

Thank you!

Since MouseX/MouseY are server-side, your options are either to use them directly in your SynthDef OR (and this is probably the better/more flexible choice in your case) to make a separate Synth that writes mouse coordinates to a control Bus and map that bus to a Control in your Synth.

So in addition to the SynthDef and Synth in your example, you’d add something like:\mouse, {\, }).add;

~mouseBus = Bus.control;
~mouse =\mouse, [\outBus, ~mouseBus]);\p0, ~mouseBus)