1. Learn
    2. Saturation and distortion
    3. Waveshaping

    What is waveshaping?

    Waveshaping changes a sound by passing every sample through a fixed curve, called a transfer curve, that maps each input level to an output level. A straight diagonal line changes nothing. Bend the line and the shape of the wave changes, which adds harmonics, and that one idea is behind saturation, clipping, wavefolding and bitcrushing.

    What it is
    A curve that gives every input level a new output level
    What it adds
    Harmonics, more of them the further the curve bends
    The main controls
    Drive into the curve, the shape of the curve and the mix
    Where you find it
    Saturator, distortion and clipper plug-ins, and synth distortion units
    SAT·1Saturation lab
    Whole loopInput after driveOutput
    One peak, sample by sample
    Transfer curve
    The line bends only at the ends

    Soft clip

    Soft clip with 0.0 dB of drive. The curve treats the top and bottom of the wave the same, so only odd harmonics appear: 2 of them louder than −60 dB, led by the 3rd at −25 dB. Auto gain is turning the result up by 1.5 dB to keep it as loud as the original.
    2Added, 0 even
    +1.0dB above 3k
    2.5Crest, was 3
    Harmonics on a 110 Hz sineOddEvenOther
    Spectrum of the loopOriginalOutput
    Drive+0.0 dB
    Character0%
    Bits8.0
    Rate6.0 kHz
    ToneOpen
    Mix100%
    Output0.0 dB

    Follow the steps. Each one sets the controls for you and tells you what to listen for.

    Step 1 of 8
    A sine through a gentle curvePress play. A 110 Hz sine is going through the soft clipper's curve with no drive. On the transfer curve the line follows the dotted diagonal through the middle and only bends near the ends, so just the tips of the wave get rounded. That's enough for a 3rd harmonic 25 dB below the note, with a much smaller 5th at −48 dB and a 7th you can barely see at −71.
    Train your earsThe lab plays the current sound through one of three characters with the screens covered, at the same loudness as the original, and you name it. The bass and the chords make it easiest to hear.

    Generated in your browser.

    Waveshaping in plain English

    Digital audio is a long list of numbers called samples, 44,100 or 48,000 of them every second, each one saying how far the speaker should be pushed out or pulled in at that instant. A waveshaper takes each of those numbers, looks up a new value for it on a curve, and outputs the new value instead. That's all it does.

    If the curve is a straight diagonal line, every number comes out as it went in and you hear no change. If the curve bends, some numbers come out smaller or bigger than they went in, so the shape of the waveform changes. A wave with a different shape has different harmonics, the extra frequencies at whole-number multiples of the note, and depending on how the curve bends you hear them as warmth, grit, fuzz or buzz.

    Almost every saturation and distortion plug-in has a waveshaper at its heart. The saturation lesson covers what saturation is for and where to use it. This page is about the curve itself, because once you can read one, you can predict what any of those plug-ins will do.

    How to read a transfer curve

    A transfer curve is a graph with the input level along the bottom and the output level up the side. Both run from −1 to +1, which is full scale in either direction, so the centre of the square is silence. To find out what happens to any sample, find its value on the bottom edge, go straight up to the curve, and read across.

    The dotted diagonal is the line that changes nothing. Wherever the curve sits on the diagonal, that part of the wave passes through untouched. Where it flattens off, loud samples get squashed towards a ceiling, and where it gets steeper than the diagonal, small differences get exaggerated.

    Take the soft clipper in the lab, which uses a curve called tanh (the hyperbolic tangent). Near the centre it's almost exactly diagonal, so a sample at 0.1 comes out at 0.0997, but it flattens towards the ends and a sample at 0.9 comes out at 0.72. Run a whole sine wave through it and the middle of each cycle is left alone while the tops and bottoms get rounded off.

    The left panel is the curve and the right panel is a sine before (dashed) and after (solid). Through 4x³ − 3x, a full-scale sine comes out as exactly three cycles for every one that went in, a pure 3rd harmonic with the original note gone. The 2nd-order curve does the same with the 2nd harmonic, and the rectifier flips the bottom half of the wave up, which doubles the pitch.

    The figure above shows how far that idea goes. Each of those curves was chosen for the wave it makes, and the 3rd-order one turns a sine into a sine three times higher. The two middle ones are Chebyshev polynomials, the maths behind waveshaping synthesis, which comes up further down.

    Reading the lab

    The lab opens on a 110 Hz sine wave, the plainest test sound there is: one frequency and no harmonics, so anything new that turns up must have come from the curve. Five cards across the top pick the curve. The first four are waveshapers, and the fifth, the downsampler, is there for comparison.

    The square screen is the transfer curve for the current settings, with dashed amber lines marking where the loudest peaks of the sound land on it. Beside it, the close-up shows two milliseconds of the wave, sample by sample, with the input dashed and the output solid. The harmonics screen under them runs the sine through the same settings and measures each new harmonic in dB against the note: odd ones in pink, even ones in amber, and anything that isn't a harmonic at all in grey.

    The panel on the right describes what your settings are doing with numbers measured from the actual sound, and it changes as you turn the knobs. Auto gain keeps the output at the same loudness as the input, and A/B switches the curve off, so you can judge the tone without the level fooling you. The tone control is locked on this page, so everything you hear comes from the curve.

    You can swap the sine for a bass, chords, a lead, a guitar or drums with the buttons in the top bar, or use your own recording.

    Drive: how far along the curve you go

    A waveshaper treats loud and quiet samples differently, because they land on different parts of the curve. Drive is a volume knob in front of the curve, and it leaves the curve's shape alone: turning it up sends the wave further along the curve, into the parts that bend.

    Here are the numbers on the soft clipper. With no drive, a sample at −20 dBFS comes out almost exactly as it went in, and the 110 Hz sine in the lab gains a 3rd harmonic 25 dB below the note. Add 12 dB of drive and that quiet sample lands at −8 dBFS, still on the nearly straight part, so it comes out only about half a decibel lower. A loud sample at −1 dBFS gets driven to +11 dBFS, deep into the flat end, and comes out at 0 dBFS, 11 dB lower than it went in. On the sine, the 3rd harmonic rises to −12 dB and four more odd harmonics join it.

    On real music, a waveshaper distorts the loud parts of a sound more than the quiet parts. A bass note gets grittier on its attack and cleaner as it dies away, and a guitarist playing softly through an overdrive pedal gets a cleaner sound than one digging in. Because the loud peaks get pulled down more than the rest, the crest factor also shrinks, which is part of why driven sounds feel denser.

    The level going in is part of the setting. If you put a gain plug-in before a waveshaper and turn it up 6 dB, you've changed the distortion as much as if you'd turned the drive knob, so set your levels first and then dial in the drive.

    Symmetry: odd and even harmonics

    The shape of the curve decides which harmonics you get. When the curve does the same thing to the negative half of the wave as to the positive half (a mathematician would say the curve is odd, meaning f(−x) = −f(x)), the top and bottom of every cycle get bent the same way, and only odd harmonics appear: the 3rd, 5th, 7th and on up. The soft clipper, the hard clipper and the wavefolder in the lab all start out symmetrical.

    Tilt the curve so it treats the two halves differently and even harmonics appear too: the 2nd, an octave above the note, then the 4th, 6th and so on. With 12 dB of drive on the soft clipper, setting the character to 60% brings in a 2nd harmonic at −22 dB and a 4th at −26 dB without changing the odd ones much. The even vs odd harmonics lesson covers how the two sound different.

    A lopsided curve also shifts the middle of the wave up or down, which is called DC offset. It's a constant push in one direction that you can't hear, but it eats headroom and can make a click when the sound starts or stops. A plug-in with an asymmetry control should filter it out after the curve, and the lab does.

    Common waveshaping curves

    Plug-ins give their curves names like Tube, Diode or Fold, but nearly all of them are variations on a handful of shapes.

    Waveshaping curves and what they add
    CurveShapeWhat it addsSounds like
    Soft clip (tanh, arctangent)Straight in the middle, bending smoothly flat at the endsOdd harmonics, falling away quicklyWarm, rounded saturation
    Hard clipStraight up to a ceiling, then flatA long row of odd harmonics, plus aliasingBuzzy, bright distortion
    Asymmetric curveBends one half of the wave more than the otherEven and odd harmonicsFuller and closer, like a valve
    Wavefolder (sine)Rises, then turns back down past a pointStrong high harmonics that change fast with driveHollow and metallic
    Rectifier (absolute value)Flips the negative half upEven harmonics, with the note itself goneAn octave up, fuzzy
    Staircase (bitcrusher)Flat steps instead of a lineHarmonics plus grainy noise between the stepsLo-fi and gritty

    Soft and hard clipping

    Both clippers flatten the peaks; the difference is how suddenly. A soft clipper bends gradually, so the harmonics it adds fade out quickly as they go up. A hard clipper is perfectly straight until full scale and then completely flat, and that sudden corner needs a long row of high harmonics to build. With 12 dB of drive on the sine, the hard clipper puts the 3rd harmonic at −10 dB, the 5th at −17 and the 7th at −23, and they keep going well past the last bar on the screen. The clipping lesson goes further into both.

    Wavefolding

    Every curve so far keeps going up, or at least stays flat, as the input rises. A wavefolder's curve rises and then turns back down, so a peak that goes past the turn comes out lower than a smaller peak would. Each cycle of the wave gets folded over on itself, and every extra fold adds another wiggle.

    The lab's folder uses one hump of a sine wave as its curve. With 6 dB of drive, the 3rd harmonic comes out at −3 dB, almost as loud as the note. At 14 dB of drive the 3rd, 5th and 7th harmonics are all louder than the note, and however hard you drive it, the curve itself never goes past full scale. Wavefolding is a big part of the sound of Buchla synthesizers and what's called west coast synthesis, and the wavefolding lesson covers it on its own.

    Rectifying

    A rectifier keeps the positive half of the wave and flips the negative half up, so every dip becomes a bump. One cycle of a sine turns into two bumps, so the pitch jumps an octave and the note you started with disappears. Octave fuzz pedals such as Roger Mayer's Octavia, built for Jimi Hendrix, get their octave-up sound from rectification. Switch the figure above to Rectifier to see it.

    The staircase

    A bitcrusher rounds every sample to the nearest of a few fixed levels. Drawn as a transfer curve, that's a staircase, and since each output depends only on the input at that instant, it's as much a waveshaper as a clipper is. The steps add harmonics and a grainy error that sounds like noise on quiet sounds. At 3 bits, the harmonics on the sine sit between −37 and −26 dB, and the part of the error that isn't a harmonic of the note shows as the grey bar at −32 dB. The bitcrushing lesson goes into bit depth in detail.

    What isn't waveshaping?

    A waveshaper has no memory. It doesn't know what the previous sample was or what comes next, and the same input always gives the same output. Anything that changes over time, or depends on more than the current sample, is something else.

    The downsampler in the lab is the clearest example. It holds each sample until the next one is due, which depends on time and has nothing to do with level, so its transfer curve is a straight diagonal. It still wrecks the sound, adding tones at −24 dB that aren't harmonics of the note, by a different route that bitcrushing vs sample rate reduction compares directly.

    EQ and filters aren't waveshaping either: they only change the level of frequencies already there, however hard you push them. A compressor turns the level down over milliseconds, following the loudness of the sound, so it changes dynamics without reshaping each cycle much. Shorten its attack and release far enough and it starts to follow the wave itself and distort, and at that point it's behaving like a waveshaper.

    Real analogue gear sits in between. Tape and valve circuits have a curve at their core, but they also have memory: tape loses top end as you drive it harder, and a valve stage's bias can shift on loud passages. Good plug-in models wrap a static curve in filters and level-dependent behaviour to copy that, which is why two tube plug-ins with similar curves can sound different.

    Sharp corners and aliasing

    A digital system can only store frequencies up to half its sample rate, so 22.05 kHz at 44.1 kHz. When a curve adds harmonics above that limit, they don't vanish. They fold back down into the range you can hear as aliasing, landing at frequencies that have nothing to do with the note, which sounds harsh and out of tune, especially on high notes.

    How much a curve aliases depends on how smooth it is. A curve made from a polynomial (a sum of powers of x) of degree N can only add harmonics up to the Nth on a sine, so a cubic curve on a 2 kHz tone adds nothing above 6 kHz. A curve with a sharp corner, like a hard clipper, adds harmonics that go on forever. In the lab, the soft clipper's grey bar stays empty while the hard clipper's shows aliasing at about −69 dB, from the same sine at the same drive.

    The fix is oversampling: the plug-in raises the sample rate inside itself, runs the curve, filters off everything above the original limit and converts back down. Plenty of distortion plug-ins have an oversampling switch, and the Web Audio API's WaveShaperNode offers 2x and 4x. The aliasing and oversampling lesson covers when it's worth the extra processing.

    Waveshaping synthesis

    Waveshaping is also a way to build sounds from scratch. Start with a sine from an oscillator and send it through a curve, and the curve decides which harmonics come out. Marc Le Brun described this as digital waveshaping synthesis in the Journal of the Audio Engineering Society in 1979, using Chebyshev polynomials: the nth one turns a full-scale sine into its nth harmonic, so mixing several of them gives you any set of harmonic levels you choose.

    Those exact harmonics only come out when the sine hits the curve at full scale, and that limit turns out to be useful. At lower levels the sine only reaches the middle of the curve, where it bends less, so fewer of the upper harmonics come out. So the level going into the curve works like a brightness control, and putting an envelope on it makes notes start bright and mellow out as they decay, much as a filter envelope would. A synth with a distortion stage after its oscillator can be used the same way, and so can Ableton's Saturator in Waveshaper mode on a sine.

    Waveshaping a real sound

    A sine shows the curve clearly, but music has many frequencies at once. A curve adds harmonics of each note and also new frequencies at the sums and differences between notes, called intermodulation, so chords turn rough much sooner than single notes do. The harmonics lesson measures this on the chord loop in the lab.

    For the same reason, waveshaping suits sounds that play one note at a time. A bass line or a vocal takes a lot of drive before it falls apart, while pads and full chords usually want very little, or want the distortion applied to each part before they're combined. Try the last step in the lab on the bass, then pick Chords with the same settings.

    How to use a waveshaper, step by step

    1. Set the level going inA waveshaper reacts to level, so fix the input gain first. If the part is going to get louder or quieter later, do that after the waveshaper or the distortion will change with it.
    2. Pick the curve for the jobA soft curve gives warmth you barely notice and a hard clipper gives buzz. Reach for an asymmetric curve when you want a stronger 2nd harmonic, or a folder for a synth tone that moves.
    3. Bring the drive up slowlyStart at zero and raise it until you hear the edge of the notes change, then go a little past and back off.
    4. Match the output levelUse the plug-in's auto gain or output knob so the processed sound is as loud as the original.
    5. Compare with it switched offAt matched loudness, decide whether it helped. If you can't tell, there's probably too little drive to matter.
    6. Blend if it's too muchPull the mix down to 30 to 50% to keep the original's weight with the harmonics underneath, which is parallel saturation.
    7. Turn on oversampling for bright or high soundsHard curves on hi-hats, leads and vocals alias the most, so those are the sounds that benefit.

    Common waveshaping mistakes

    Judging it louder

    Waveshaping usually makes a sound louder, and a louder version nearly always wins a quick comparison. Match the levels before you decide, which is what the lab's Auto gain does for you.

    Forgetting that level is part of the setting

    Turning up the track feeding a waveshaper changes the distortion. If a part sounded right yesterday and wrong today, check whether something before the plug-in got louder.

    Hard curves with no oversampling

    A hard clipper or a folder on a bright sound at 44.1 kHz adds aliasing that sounds like harsh, out-of-tune whistling on high notes. Switch on oversampling, or use a softer curve.

    Distorting full chords

    Intermodulation between the notes of a chord turns it to mud long before a single note would. Use less drive on chords, or distort each part before they're mixed together.

    Training your ears to hear the curve

    The quiz under the lab plays the current sound through the soft clipper, the hard clipper or the wavefolder with the screens covered and the levels matched, and you name the curve. Listen to the edges of the notes: the soft clipper rounds them, the hard clipper puts a buzz on top, and the folder sounds hollow and metallic. The bass and the chords are the easiest sounds to start on, and your best score is saved in your browser.

    Questions people ask

    Is waveshaping the same as distortion?

    Waveshaping is one way of making distortion, and the most common one in plug-ins. Most plug-in saturation, overdrive, clipping and fuzz is waveshaping with a different curve and a different amount of drive, often with filters around it. Some effects that get called distortion, like downsampling, work another way.

    What does a waveshaper do to a sine wave?

    It changes the shape of each cycle while keeping its length. A curve that's the same on both sides adds odd harmonics, at 3, 5, 7 and more times the frequency; a lopsided one adds the even ones in between as well. A pure sine is the best test sound, because anything new on a spectrum must have come from the curve.

    Why does a waveshaper sound different at different levels?

    Because the curve is fixed and the input moves along it. Quiet samples stay on the straight middle part and come out almost unchanged; loud ones reach the bent ends and get reshaped. That is why turning up the drive, or playing harder into it, sounds dirtier.

    Does waveshaping cause aliasing?

    It can. A curve adds harmonics, and any that land above half the sample rate fold back down as out-of-tune tones. Smooth curves add few high harmonics and alias very little; curves with sharp corners, like a hard clipper, add an endless row of them. Oversampling runs the curve at a higher sample rate to keep that under control.

    What is a transfer function?

    Another name for the transfer curve: the rule that turns each input level into an output level. Plotted as a graph, input runs along the bottom and output up the side, and a straight diagonal line means the sound passes through unchanged.

    Can I draw my own waveshaping curve?

    Yes, in some plug-ins. FL Studio's Fruity WaveShaper lets you draw the curve point by point, and Ableton Live's Saturator has a Waveshaper curve type with its own set of controls. In code, the Web Audio API's WaveShaperNode takes the curve as a list of numbers.

    Keep going

    Zac Dobos

    Zac runs Sounds Like You, which makes sample packs, preset packs and the Murmur granular synth plug-in. The lessons in Learn are free, and every one has a working version of the effect in it.