How can i maintain the distorted signal when recording?

Hello everyone, I’m not sure if I’m formatting this post correctly but I am trying.

I have posted my code below for a synth bass I’m going to use in a composition, the sound is clipping HARD and it sounds really cool.
I’ve recorded it as it is and the gain gets reduced massively and no longer sounds cool and buzzy when I listen to it. I have also tried using a -30/-10.dbamp attenuation and have also tried .tanh

Although they sound much better when recorded, they lose some of that insane clipping that makes it sound cool to me.

Could anyone help me find a way to be able to record the sound as I hear it when it clips?
Thank you

(

// setting the scale to be used in the Pbind by assigning it to a variable
~a = Scale.locrian;

// creating the synthdef and giving it a few arguments
SynthDef(\bass, { arg dur, freq, amp=0.2, out=0, 
	pmax=1, pmin=(-1), 
	cfmax=250, cfmin=150, 
	rqmin=0.1, rqmax=0.5,
	modFreq=30;
	
	// declaring the variables to be used
	var sig, sin, saw, tri, hiSaw,
	env, panner, phase, 
	lpf, bpf, modSin, am, rhpf;
	
	// defining the phase variable to move between the phase of the sine wave
	phase = SinOsc.ar(
		LFNoise1.kr(2).exprand(pmin, pmax)
	);
	
	// setting up the oscillators, utilising the phase variable, saw is half the frequency
	sin = SinOsc.ar(freq, phase, 0.5);
	hiSaw = Saw.ar((freq*2), 0.5);
	saw = {Saw.ar((freq/2), 0.35, 1.0)}!2;
	tri = LFTri.ar((freq/4), phase, 1.0);
	
	// making the envelope and the filters, the filters change as the synth progresses
	env = EnvGen.kr(Env([0, 0.8, 0.9, 0.5, 0.0], [0.1, 1.0, 0.25, (dur/2)]), doneAction:2);
	lpf = LPF.ar(sin,
		LFNoise1.kr(0.5).exprange(300, 500)
	);
	
	bpf = BPF.ar(saw,
		XLine.ar(100, 1500, 0.5, 1.0),
		LFNoise1.ar(0.5).exprange(rqmin, rqmax)
	);
	rhpf = RHPF.ar(hiSaw, 
		XLine.ar(500, 2000, 0.5),
		XLine.ar(0.1, 0.5, 10)
	);
	
	// summing things together to spit out the signal, am, which is then sent to the panner and added 
	hiSaw = ((hiSaw * env) * rhpf) * amp;
	sin = (sin * lpf);
	saw = saw * bpf;
	sig = ((saw + sin) * tri) * env;
	modSin = SinOsc.ar(modFreq);
	am = ((sig * modFreq) + hiSaw);
	panner = Pan2.ar(am, 0, 0.5);
	Out.ar(out, panner);
}).add;

)

You can manually add hard clipping by using signal.clip(low, high).
Perhaps you could do this in your synth…

signal.clip(\amp.kr(0.2).neg, \amp.kr);

Whait, if it is not recorded in a floating-point audio format, but for example 16bit, it clips and distort badly…

I’m recording it as a .WAV file, do I need to set the bit depth and sample rate in the server options?

Thank you for your reply! Though I’m not sure how to implement this. I’m quite new to supercollider so I’m sorry if this is painfully simple!

panner = Pan2.ar(am, 0, 0.5);
panner = panner.clip(-0.5, 0.5);
Out.ar(out, panner);

It is possible some of the sound comes from depth and sampling rate. You can use Decimator for that.

You are very clever thank you! I’ll look into decimator but for now the recorded version sounds just as distorted as the sound from supercollider!!