Not actually that hard. You want a WaveShaperNode. Of course, tuning the curve and other parameters so it sounds _good_ is nontrivial.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperN...
[1]: https://developer.mozilla.org/en-US/docs/Web/API/WaveShaperN...