Looking for starting point to write (or reuse) some "natural" sounding sound distortion

Hi, I’m searching for some some UGens, quarks, code snippets to start experimenting on “natural” sounding sound distortion. The goal would be treat live instruments, to distort them somehow but keep on recognizing them. A bit like a guitar distortion pedal effect would do.

Any idea where I could start from ?

5 Likes

Distortion design is a deep topic and I’ll only scratch the surface here.

The most basic kind of distortion is stateless nonlinear waveshaping. tanh and distort give you saturation-type distortion. However, you won’t get a good-sounding guitar pedal with just tanh. The trick to get better distortion is to use EQ in series before and after the waveshaper. A good starting point:

  1. Use BHiShelf to attenuate the highs. This keeps the distortion from being too ear-splitting, and also reduces aliasing in a digital context.
  2. Use BLowShelf to attenuate the lows. This prevents, uh… flatulent sound.
  3. Apply tanh.
  4. Use BLowShelf to bring the lows back up again.
  5. Use BHiShelf to bring the highs back up again.

That’s the basics. Here are some areas to experiment:

  • Add a dc bias to the signal prior to distortion. Remember to take it out afterwards, either by subtracting a constant or using LeakDC.
  • Use multiple alternating layers of EQ and distortion in series.
  • Use multiple distortion signal chains in parallel, added together.
  • Use a band splitter and distort each band with a different signal chain.
  • Make EQ parameters dependent on the Amplitude.ar of the signal.
  • Raising the signal to an odd power, such as x ** 5, gives you a “pinch” distortion which can sound really interesting.
  • For wilder sounds, try nonmonotonic waveshaping like fold2 or abs, or discontinuous waveshaping using wrap2.
14 Likes

Here’s a (probably incomplete) list of distortion UGens in sc3:

// core distribution
Fold                // like .fold2, but with adjustable low/high thresholds
Shaper              // waveshaping using arbitrary transfer function wavetable

// miSCellaneous_lib quark
// search for "Smooth Clipping and Folding" in the help browser
SmoothClipS         // waveshaping/clipping using sine segments
SmoothFoldS         // wavefolding using sine segments
SmoothFoldS2        // same but with separate low/high fold range controls
SmoothFoldQ         // wavefolding using parabolic segments
SmoothFoldQ2        // same but with separate low/high fold range controls

// @madskjeldgaard's PortedPlugins
// https://github.com/madskjeldgaard/portedplugins
AnalogTape          // virtual analog tape model w/ variable oversampling and antialiasing
AnalogVintageDistortion // virtual analog vintage EQ and distortion 
LockhartWavefolder  // virtual analog wavefolder w/ antialiasing
NonlinearFilter     // filter with saturation in the feedback loop


// all of the plugins below require sc3-plugins!
// https://github.com/supercollider/sc3-plugins

// MCLD (Dan Stowell)
InsideOut           // subtracts amplitude from 1
Squiz               // wave squeezer (weird pitch-shifting)
WaveLoss            // discard fraction of waveform segments

// BerlachUGens
// the numbers stand for oversampling amount
// haven't tried these yet
Clipper4, Clipper8, Clipper32
SoftClipper4, SoftClipper8
SoftClipAmp, SoftClipAmp4, SoftClipAmp8
OSWrap4, OSWrap8
OSFold4, OSFold8
OSTrunc4, OSTrunc8
DriveNoise

// ported ladspa plugins
CrossoverDistortion // power amp distortion simulation
Disintegrator       // amplifies/attenuates random half-cycles of the waveform
Decimator           // sample and bit rate reduction
SmoothDecimator     // same, but with smoothing parameter instead of bit rate
SineShaper          // sine-based static waveshaper

// DEIND
DiodeRingMod        // ring modulation based on physical model of a diode

I tried to add brief summaries of their behavior, but since I haven’t thoroughly tested all of them myself, I mostly went by their help file descriptions. As you can tell, they implement/emulate some of the more commonly encountered distortion types like clipping, bitcrushing, “drop-outs”, waveshaping etc.

This talk by Ivan Cohen is an excellent survey of different distortion effects:

Most plugin emulations of “vintage” distortion effects like pedals and amps rely a lot on oversampling to reduce audible aliasing, because distortion quickly introduces frequencies above Nyquist. Since the “reflected” aliasing frequencies are not harmonically related to the input sound, they have a distinctive “digital” character and virtual analog plugin developers put a lot of effort into attempts to mitigate them, but [insert essay about Yasunao Tone’s works and the ideal of “transparent” sound reproduction here :slight_smile: ]. Unfortunately, there doesn’t seem to be any way in sc to oversample an arbitrary synth graph (something like the poly~ object in Max) - if there is, I’d love to know! But a great strength of SuperCollider is the ability to very easily derive modulation signals from musical sources using “machine listening” UGens or simple envelope followers (like Amplitude.ar as mentioned by nathan, but there’s a whole host of them included in sc) and use those to dynamically adjust the parameters of your distortion effects, something also alluded to in the talk I linked above. This can make for very interesting distortion effects that aren’t easily achievable with commercial “analogue” emulations of vintage hardware.

Finally, here are some materials from a class taught by Miller Puckette (creator of Pure Data) at UCSD devoted entirely to feedback and distortion effects.

13 Likes