Why doesn't RandSeed and WhiteNoise pass a null test, is this a bug?

I was expecting this to pass a null test, but it doesn’t…

s.bind {
	{
		RandID.kr(id: 10);
		RandSeed.kr(Impulse.kr(1), 1);
		WhiteNoise.ar
	}.play;
	{
		RandID.kr(id: 10);
		RandSeed.kr(Impulse.kr(1), 1);
		WhiteNoise.ar * -1
	}.play
}

Does anyone know why? Or am I doing something wrong?

s.bind won’t be reliable with {}.play, because the s_new message is executed asynchronously as a completion message for the d_recv message.

hjh

Doesn’t work like this either

SynthDef(\l, {
	RandID.kr(id: 10);
	RandSeed.kr(1, 1);
	Out.ar(0, WhiteNoise.ar)
}).add;

SynthDef(\r, {
	RandID.kr(id: 10);
	RandSeed.kr(1, 1);
	Out.ar(0, WhiteNoise.ar * -1)
}).add;

s.bind {
	Synth(\l);
	Synth(\r);
}

current dev, linux x8664

In your example, both Synths use the same random number generator, so the output cannot be the same. You need to give each Synth its own generator, but seed them to the same value. The following does indeed produce silence:

(
SynthDef(\rand, { |id, amp|
	RandID.kr(id: id);
	RandSeed.kr(1, 1);
	Out.ar(0, WhiteNoise.ar * amp)
}).add;
)

(
s.bind {
	Synth(\rand, [ id: 10, amp: 1 ]);
	Synth(\rand, [ id: 11, amp: -1 ]);
}
)
1 Like