Fixing AudioControl and InFeedback

Hello everyone!

I have noticed a weird behavior of the AudioControl and InFeedback UGens.

If you run this code, you’ll notice that the last audio cycle will run twice, generating a “double” dropout:

(
s.waitForBoot({
	SynthDef(\test, {
		Out.ar(\out.ir(0), { SinOsc.ar(2) * EnvGen.ar(Env([1, 1], [0.2]), doneAction:2) })
	}).add;

	s.sync;

	~bus = Bus.audio(s);

	Pbind(
		\instrument, \test,
		\dur, 1,
		\out, ~bus.index,
		\addAction, \addToHead
	).play;

	~reader = { \in.ar }.play(args:[ \in, 'a' ++ ~bus.index]);

	{ In.ar(0) }.plot(0.5);
})
)

This happens because the AudioControl UGen (as well as the InFeedback one) only check if the bus has been touched in the current audio cycle. In my opinion, it should probably take into consideration if the bus has been touched in the previous audio cycle aswell, in order to avoid this “repetition” effect.

I have compiled a custom UGen that does this, and it seems to me to handle the behavior better. It basically works just like In when the ~reader Synth is later in the chain, and just like InFeedback when the ~reader Synth is before in the chain (reading the previous audio cycle).

Pbind (\addToHead) -> ~reader:

-> ~reader Pbind (\addToTail) ->:

Would you think the current behavior of AudioControl and InFeedback is faulty as I do? Do you think it’s worth to make a PR to SuperCollider to fix this?

1 Like

Yes, would be great to fix this. I don’t see any reason to maintain backward compatibility for the doubled buffer.

hjh

Opened a PR: