Does suppercollider clip the output?

This is related to my previous post about the way SuperCollider sounds when compared to Pd, which ended up concluding there was no difference.

But then, when porting this code to Pd…

({  arg freq = 80;
	var sig, fenv, env;
	env = EnvGen.ar(Env.new([0.4, 1, 0], [0.002, 20], -250));
	fenv = Env([freq*1.25, freq*1.125, freq], [0.1, 0.5], -4).ar;
	sig = SinOsc.ar(fenv, pi/2) * env;
	(sig * 3)!2;
}.play(fadeTime: 0))

I realized it can only sound similar if I clip the output in my Pd patch, as the thing really goes beyond the -1 to 1 range thanks to the “* 3” in the end…

This is again that same code for TR-808 (now the low tom) I found somewhere online.

for comparison, I have this

({  arg freq = 80;
	var fenv = Env([freq*1.25, freq*1.125, freq], [0.1, 0.5], -4).ar;
	var env = EnvGen.ar(Env.new([0.4, 1, 0], [0.002, 0.6], ['lin', -7.4]));
	var sig = SinOsc.ar(fenv, pi/2) * env;
//	(sig * 3)!2;
	Clip.ar(sig * 3, -1, 1)!2
}.play(fadeTime: 0))

Which doesn’t sound exact to me, but sounds very similar, and not clipping in my Pd patch sounds nothing like this but I can’t show it to you unless you have Pd… this is because recording it into a file does generate a cliped wav, and here’s the clipped file sound

Similar, right?

I guess SuperCollider, as a safe guard, could be clipping, and then, actually I don’t really know and understand how Pd is not clipping and I should ask that in the Pd list, cause maybe Pd can potentially blow up my macbook air speakers :slight_smile:

it’s funny though how I don’t think the clipped SC patch sounds exactly the same… and I wouldn’t know how to easily generate audio files in SC so I can test and compare both these outputs… and also how they compare to Pd’s.

I think clipping behavior depends on the platform.
On macOS there is ServerOptions-safetyClipThreshold which defaults to 1.3. Actually I suggested this since otherwise the attenuated headphones (or else) will go beyond the set value of the volume, which can easily result in hearing damage. I don’t know what other platforms and audio frameworks do.