Programmatically (e.g. in Python) adding clipping to an audio file?
Simple clipping :
threshold = 0.5
If x > threshold
  x = threshold
elseif x &lt; -threshold
  x = -threshold
end

Real-world clipping can be significantly more complex than this, involving various time-constants, asymmetry, heating-effects,....