| Oversampling won't help with the brickwall clipping being attempted here. This circuit is not a diode emulator, it's a comparator. It's the worst-sounding of all distortions. It sounds even worse in digital because of the aliasing. And it will always alias, no matter how much you oversample it, because a vertical edge - aka "Heaviside Step Function" - has an infinite harmonic series. If you oversample it enough it won't alias much because the series terms become smaller. But they never disappear. A better way to do this kind of clipping is with a tanh (logistic/s-curve) approximation. That can give you a variety of valve-like [1] smooth clipping curves. Unfortunately tanh is pretty expensive computationally, so a more practical alternative is a piecewise curve, perhaps with some interpolation. Although if you only have 8-bit or 16-bit resolution you may as well just use a lookup table. OP might want to consider learning a little more about signal theory and practical DSP before posting more how-tos. [1] Not really because real valves are more complicated. But it will do for a first approximation. |
The lower the barrier of entry, the more cool things that people can come up with! I'm hoping that more without a math/EE/audio background like myself can get started and explore some more of these deeper topics :)