Pbind fails to work - everything is "late"

Hi, frustratingly I’ve been able to make Pbind work with no problem but now out of nowhere it never works. All that happens is lots of silence, followed by many sounds all at once and numerous late messages in the post window. Would anyone know the cause of this? What can I do to fix it?

I’ve tried killing all the servers with Server.killAll; as well as rebooting my computer. I’m running a 2020 Macbook pro with macOS Montery 12.3.

Here is an example of something that doesn’t work. None of the examples in the help files work.

SynthDef(
	\pleaseWork,
	{
		var envelope = EnvGen.kr(Env.perc(0.001, 0.2), doneAction: 2);
		Out.ar(0, SinOsc.ar(400) * envelope);
	}
).add;

Synth.new(\pleaseWork);

p = Pbind(
	\instrument, \pleaseWork,
	\dur, 1/4
).play;

Thanks!

I don’t think there is anything wrong with your code, works perfectly for me on Monterey.

That suggests a discrepancy between the concept of “now” in the server vs the language. But the symptom you describe is puzzling. “Late” messages mean that the timestamp attached to the outgoing bundles to the server is in the past. But in that case, there shouldn’t be “lots of silence” – I’d have expected the server to try to catch up immediately.

Also, the server and the language both update their time base according to the system’s clock, 2-3 times per minute, so this shouldn’t be an ongoing problem.

I’ve seen timing problems in Linux when network time protocol is enabled. You might try turning that off when using SC…? Grasping at straws a bit, but this is one system component that is known to mess up language/server timing when it adjusts the OS clock. Disabling it would eliminate one possible source of the problem…? But I can’t promise it would fix it on your machine.

hjh

Or… This could happen if something at the beginning of the code block took a very long time to execute.

But there’s nothing in your posted example that would do that.

Did you install any quarks or other extensions lately?

Is there a delay for all code blocks, or only for sound production?

hjh

No quarks and no delay for any other code block execution other than routines where the same kind of behaviour also occurs.

This is really weird.

Let’s make some concrete measurements.

thisProcess.recompile;  // start with a clean slate

(
var printTime = { |label|
	"%: logical time = %, physical time = %\n".postf(
		label,
		SystemClock.seconds,
		Main.elapsedTime
	);
};

printTime.("start");

TempoClock.sched(0, Routine {
	3.do { |i|
		printTime.("routine, index " ++ i);
		1.0.wait;
	};
});
)

The correct result is like this:

start: logical time = 213.0509114, physical time = 213.051128783
-> TempoClock
routine, index 0: logical time = 213.0509114, physical time = 213.051418576
routine, index 1: logical time = 214.0509114, physical time = 214.051711047
routine, index 2: logical time = 215.0509114, physical time = 215.051486786

“start” and “routine, index 0” should have the same logical time.

Physical time should always be very close to, but slightly later than, the same row’s logical time.

Are your readings different?

hjh