Home         Download         Donate         Register         Forums         Help   
Stereo Tool 7.83 - Help - Declipper


Declipper section

Repairs clipped audio: Removes distortion and restores dynamics.



Perfect Declipper improves the audio quality of too loud recordings. This includes most modern CD's and MP3's (see 'Why should I use it' on the right). It does this by calculating the missing (clipped) information from the data that is still available.

Declipping consists of 3 steps: How well declipping works is determined by the combination of these 3 steps.

Why should I use it?
In the 1980's, CD's were expensive and only available in high-end systems - and hence most CD's were recorded at the best possible quality. In the last two decades, due to what is called the loudness war, music has been released at continuously increasing volume levels. This has come at a cost: Reduction of dynamics and clipping. Clipping means that the loudest spikes in the music are cut off, which causes digital clipping distortion. In the last few years, it has gotten so bad that in some cases you can even clearly hear the distortion on laptop speakers.

Perfect Declipper can restore the clipped parts of the audio, in many cases the result is indistinguishable from the original, not clipped, recording. In the process, it also restores part of the dynamics.

Do I need high-end audio equipment to hear the difference?
No! In fact, I've received many emails and messages from people who stated that their cheap equipment suddenly sounded like a high-end system to them. Even on the cheapest headphones the difference in quality is amazing. Just check the samples on this site.

Is declipping useful if we are going to clip the audio again anyway at the end of the processing?
Yes! Stereo Tool's Advanced Clipper detects whether distortion is noticeable and usually does not cause audible distortion. And if the declipper output is fed into another processor, especially older processors that were not built to handle clipped audio, the increased dynamics help a lot to generate a much more constant and much better quality sound.


General panel

Overall declipper controls.

  • Enabled
    Enables the declipper.


Input section

Description of the type of input signal.

Many things in the input path can affect clipped samples. On a CD, it's usually (but not always!) easy to see: Samples at the absolute top or bottom are clipped, and other samples are not.

But in many cases the audio from the CD does not reach Stereo Tool directly. There can be an analog studio (which can causing tilting of the audio), recordings can be compressed with a lossy compressor such as an MP3 encoder (try to avoid that if possible! It makes perfect declipping impossible, although it's still possible to make a big improvement.)

Input Type panel

How the audio reaches Stereo Tool.

  • Analog input
    Check this if the input is analog, or if it has been resampled.

    If the input is analog or resampled, the position in the audio where samples are taken 'moves', which makes it more difficult to distinguish between clipped and not clipped samples.

    If this checkbox is checked, if a sample is detected as clipped, the 2 surrounding samples will also be marked as clipped. This does mean that the set of 'good' samples is reduced, which makes restoration a bit harder. But the opposite, not detecting a sample as clipped while it actually is clipped, is much worse for a good reconstruction.

Input MP3 panel

Settings to declip MP3 audio.

After MP3 encoding, audio gets spread in time, and if a sample is clipped the samples close to it will also get a part of the distortion. So, samples close to clipped samples which have a relatively high value all need to be treated as clipped.

  • Compressed (MP3 etc.) input
    The audio is (or can be) MP3 encoded.

  • MP3 dirty area
    The number of samples around a clipped sample that might be affected by MP3 encoding.

  • MP3 ignore samples near clipping if above
    Selects which sanples to mark as damaged by MP3 encoding.

    Samples in the MP3 dirty area above this percentage are marked as clipped. Note again that marking more samples as clipped makes restoration harder, but not marking a clipped sample as clipped is worse.

Input Tilt panel

Settings to detect input tilt.

Input tilt can be caused by an analog path to Stereo Tool, but there are also many CD's which contain clipped and then tilted audio.

See also Input tilt - this is where you should fix a constant tilt in the input to Stereo Tool, which also improves the audio quality. The detection in this panel only detects the tilt but does not restore it.

  • Tilt detection
    Enables automatic tilt detection.

  • Stop declipping if tilt not detectable
    If tilt cannot be detected, do not declip.

    If there's clipping, then there are usually a lot of samples on a line on the top or bottom of the waveform. And that means that the tilt can be detected. If nothing like this is present, it makes sense to assume that the audio has not been clipped, and to turn the declipper off.

  • Default tilt
    Default tilt. Normally 0 degrees.

    If there's a constant tilt present, you can set it here. However, see MP3 dirty area for a better solution that also improves the audio quality.

  • Lowest tilt
    The lowest possible tilt value.

  • Highest tilt
    The highest possible tilt value.

  • Max tilt adjustment per measurement
    The maximum speed at which tilt correction can change per tilt measurement.

    Immediately fixing anything that is detected may sometimes cause big errors, so instead the tilt level follows the measurements slowly.


Restoration section

Settings that control the declipping after detection.

These settings control things like CPU load, but also how much of clipping can be restored.

CPU usage panel

Settings that control qualiy and CPU load.

  • Quality / Precision (increases CPU load)
    Conttols how long the declipper keeps calculating to improve the results.

    This affects both the CPU load and quality. Higher values remove more distortion (but the effect is small because it's only the last bit of remaining distortion that's affected).

  • Step size reduction (higher = better hiss restoration; increases CPU load)
    Affects reconstruction of hiss-like sounds on top of loud bass.

    Loud bass in distorted audio can remove long blocks of audio. If this audio is hard to predict (noise-like sounds), it takes more effort to properly restore it. This slider increases the quality of such highs, but at the cost of a big CPU load increment. From 99% to 98%, the CPU load drops by half. The step to 96% is another drop by half, the next step to 92% is another drop by a factor two. If your CPU can handle it and you play tracks with this type of distortion, you might want to set it a bit higher than the default value.

  • Max. input distortion (increases CPU load)
    Determines how much distortion can be restored.

    A higher value also causes a slightly higher CPU load.

Peak restoration panel

Settings that affect the clipping restoration algorithm.

  • Force restored samples to be higher than original
    Does not allow restored samples to be closer to 0 than the input signal.

    This sounds logical, but in some cases the reconstruction algorithm finds a solution that has lower values than the input. If you force these to be higher, it can happen that restoration does not sound very good. On the other hand this setting protects longer blocks of high frequency noise with a bass sound which might not even be clipped, but are incorrectly detected as clipped. In some cases the declipper can introduce some intermodulation distortion - although other measures have been taken to avoid this. With this setting enabled that won't happen.

  • Maximum restored peak level
    The maximum increment of a restored sample.

    Certain waveforms, for example block wave forms, would cause a nearly-infinite peak level. This slider forces the level to stay below a certain level, relative to the original level of the sample.

    Seting a low value may cause distortion to remain present.


Detection section

Settings that control clipping detection.

A lot of different detection mechanisms are used to determine if a sample is clipped or not. Incorrectly detecting a sample as clipped is bad, because it reduces the number of 'reliable' samples that we can use to restore the audio. But, incorrectly detecting a clipped sample as not clipped is worse, because the reconstruction will use bad data.

Because of this, multiple methods are used to detect clipping, which are all designed to detect too many samnples as clipped and not to miss any. Then, the result of all these methods is combined, and only if all methods agree that a sample is clipped, it will be marked as such.

Clipping detection panel

Settings that control clipping detection.

  • Stop declipping if peaks did not increase above
    Ignore the declipping result if it did not increase the peak level enough.

    Declipping should cause the peak level to increase a bit, otherwise the samples that were detected as being clipped probably were not clipped in the first place. So in that case, the result of the restoration should be ignored and the original sample values should be used.

  • Stop declipping if texture did not increase above
    Ignore the declipping result if the output is still a flat line.

    Declipping should increase the texture of what was a (clipped) straight line. If not, the samples that were detected as being clipped probably were not clipped in the first place. So in that case, the result of the restoration should be ignored and the original sample values should be used.

  • Sample definitely clipped if above
    Always treat a sample if it is clipped above this level.

    This level is relative to the maximum peak level over a period of time, and can be different at the top and the bottom of the waveform.

    For CD input with clipping that has not been tilted, a value of 99% should be used here.

  • Sample probably clipped if above
    A sample is probably clipped if it is above this level.

    This level is relative to the maximum peak level over a period of time, and can be different at the top and the bottom of the waveform.

    For CD input with clipping that has not been tilted, a value of 99% should be used here - there is no such thing as 'probably clipped' in that case.

  • Dynamically increase probably clipped level
    Sample probably clipped if above is dynamically increased based on a histogram of sample values.

  • Sample possibly clipped if above
    A sample may be clipped if it is above this level, but not below it.

    This level is relative to the maximum peak level over a period of time, and can be different at the top and the bottom of the waveform.

    For CD input with clipping that has not been tilted, a value of 99% should be used here - there is no such thing as 'maybe clipped' in that case.

  • Dynamically increase possibly clipped level
    Sample possibly clipped if above is dynamically increased based on a histogram of sample values.

  • Sample not clipped if below
    Sample values below this (absolute) level are never clipped.

    Make sure that Input gain is set correctly, otherwies this may cause the declipper to stop functioning at very low input levels.

  • Maximum deviation from straight line
    If clipped samples do not seem to form a line, detect them as not clipped.

    This slider controls how far the samples may deviate from a straight line.

  • Sample not clipped if surrounding higher peaks
    If a sample is surrounded by higher peaks, it cannot be clipped.

  • Maximum surrounding higher peaks size
    The maximum amount surrounding peaks may be higher than this one.

    If this peak is a lot lower and Maximum surrounding higher peaks size is enabled, it will be marked as not clipped.

  • Peak level measurement: Long term: Ignore loudest
    Ignore the loudest few sample values for peak level measurement.

    Due to several causes (MP3 encoding, analog input), sometimes a few samples can peak above the clipping level. So it's safer to ignore the loudest few samples. This slider controls how many of such loud samples should be ignored.

    This is a long-term measurement, so the percentage of values to be ignored should be equal to or lower than that for Peak level measurement: Short term: Ignore loudest.

  • Peak level measurement: Short term: Ignore loudest
    Ignore the loudest few sample values for peak level measurement.

    Due to several causes (MP3 encoding, analog input), sometimes a few samples can peak above the clipping level. So it's safer to ignore the loudest few samples. This slider controls how many of such loud samples should be ignored.

    This is a short-term measurement, so the percentage of values to be ignored should be equal to or higher than that for Peak level measurement: Long term: Ignore loudest.

  • Declip if
    Determines how the maximum level is measured - short term, long term or combined.

    Either means that it uses the minimum of the two, both mean that it uses the maximum of the two - in which case the Long term vs short term margin is used to adjust the short term level.

  • Long term vs short term margin
    Adjustment of the short-term level measurement w.r.t. the long term.

  • Only detect clipping if noise above and below line is symmetrical
    Does not declip if the samples above and below the clipping level look different.

    If a sound is clipped and then noise is added (analog audio path, tilt, MP3 encoding), then when looking at the histogram it should normally look roughly symmetrical above and below the clipping level. If that's not the case, it may be an indicaton that clipping was detected incorrectly.


Veil section

An extra mechanism to prevent incorrect clipping detection.

A veil is placed on both the top and the bottom of the waveform. It rests on the peaks of the waveform, and drops down between those peaks. Only samples that are close to the veils can be clipped.

Veil panel

The veil settings.

  • Veil base elasticity
    How fast the veil drops after a peak.

    If the material of the veil is very elasical, it can fall down very rapidly, otherwise it moves down slowly.

  • Veil spike elasticity
    How fast the veil drops directly around a spike.

    Around a spike, you want the veil to drop faster to not miss any clipped samples.

  • Veil spike to normal time
    Size of the area around the peaks with a different veil elasticity.

  • Clipped if distance to veil is below
    Samples can only be clipped if they are this close to the veil.
This website is © Copyright 1999-2014 by Hans van Zutphen
Stereo Tool is shareware. You are free to give Stereo Tool to others, publish it on shareware CDs/DVDs, websites etc.