Rq stuck at default when using Event/Pbind

Hi all!

I’m running into a Event related bug and I can’t wrap my head around it. Setting the rq parameter on the synth works fine, but using it in an Event or Pbind it always has the default value of 0.1 as demonstrated by the code below. What am I doing wrong?

SynthDef(\tick2, {
	var sig, env, rq = \rq.kr(0.1);
	env = Env.perc(0, 0.2).kr(2);
	sig = Impulse.ar(0);
	sig = sig * 0.5;
	sig = RHPF.ar(sig, \freq.kr(1000), rq);
	sig = Pan2.ar(sig, \pan.kr(0)) * \amp.kr(1.0);
	Out.ar(\out.kr(0), sig);
Synth(\tick2, [\freq, 10000, \rq, 0.01]);
(instrument: \tick2, rq: 0.01, freq: 10000, amp: 1.0).play // why does the rq value not work?


Try this:

SynthDef(\tick2, {
	var sig, env;
	//env = Env.perc(0, 0.2).kr(2);
	sig = Impulse.ar(0);
	sig = sig * 0.5;
	sig = RHPF.ar(sig, \freq.kr(1000), \rq.kr(0.1));
	sig = Pan2.ar(sig, \pan.kr(0)) * \amp.kr(1.0);
	Out.ar(\out.kr(0), sig);

Synth(\tick2, [\freq, 1000, \rq, 0.001]);

(instrument: \tick2, rq: 0.001, freq: 1000, amp: 1.0).play;

Adding the synth, then cleaning up the envelope if is not in use.
I hope it helps.

Thank you! Doing some more testing it seems like when I’m using SynthDef(…).play; the changes get stored (e.g. adding polling to the SynthDef and storing with .play will print the polling results both using Event and using Synth()), but without using SynthDef(…).add; it won’t change the rq parameter using Event. Not the behavior I expected, but the fix is easy: use .add.

My guess is that under the hood .play uses .send instead of .add, .send seemingly having the same behavior.

(the envelope frees the synth so it’s not completely wasteful)

It’s the suggested way described in an own paragraph of Event’s (admittedly long) help file


Your assumption is right: do Cmd-(or Meta-)I on the selected method and choose SynthDef.play from the implementations in the popup window, then you get:

	play { arg target,args,addAction=\addToHead;
		var synth, msg;
//		this.deprecated(thisMethod, Function.findRespondingMethodFor(\play));
		target = target.asTarget;
		synth = Synth.basicNew(name,target.server);
		msg = synth.newMsg(target, args, addAction);
		this.send(target.server, msg);

Thanks for the explanation! And for the link to the helpfile, and for the Cmd-I shortcut, brilliant!