This distortion technique involves using a mathematical function to directly modify the values of the audio signal. The tanh() function can give a rounded "soft clipping" kind of distortion, and the distortion amount is proportional to the input gain. Take a look at the transfer function for tanh() with some different input amplitudes.
The following Csound code generates a sine wave and processes it with tanh() distortion. The distortion amount (drive) is controlled by the input amplitude. The output amplitude of tanh will always be in the -1.0 to 1.0 range, so the use of makeup gain is normally not necessary.
;***************************************************
; tanh distortion
;***************************************************
instr 1
iamp = ampdbfs(p4) ; Amp in -dB
icps = p5 ; Frequency for the tone generator
kDrive = p6
; audio generator
a1 oscili 1, icps, giSine
; distortion
a1 = tanh(a1*kDrive)
; audio out
out a1*iamp
endin
;***************************************************