# Restore Commands ▸ Effects ▸ **Declip…** and **Dequantise…** in the sample editor open this window in that mode, on the range that was marked, or on the whole sample when none was. **Declip** rebuilds the flat tops of a clipped recording; **Dequantise** smooths the steps of a low-bit-depth one, such as an 8-bit Amiga sample. The window analyses the region as soon as it opens, and the sample does not change until **Apply**. It works on recorded audio only: a synth or hybrid instrument is refused, and so is a packed or multi-octave sample. ## Mode and Quality **Declip**, **Dequantise**, or **Both (joint)**: one solve that keeps ordinary samples inside their quantisation steps and holds clipped ones at or above the clipping level. Both is the dequantiser with that clipping constraint added, so the declip **Algorithm** and **Strict consistency** do not apply to it. **Quality** — fastest, average (the default) or highQuality — is how long the solver works: more iterations as it goes up. For Dequantise and Both, highQuality is the same as average, 200 iterations. ## Algorithm and Strict consistency (Declip) **PW ℓ1**, the default, is a sparse reconstruction whose weights grow with the square of the frequency. **A-SPADE** keeps only the strongest coefficients of each frame. **Empirical Wiener** is the fast one. **Strict consistency** is for A-SPADE only. On, a clipped sample may not come back below the level it was clipped at. Off, the default, it may, which leaves fewer flat sections at the clipping level. ## Consistency, Prior and the two switches (Dequantise) **Consistency**: *consistent* keeps every output sample inside the quantisation step it came from; *inconsistent* lets it leave. **Prior**: **PHADQ**, the default, is phase-aware — it favours partials that change smoothly from one frame to the next, once the phase advance of a steady tone is taken out. **Plain ℓ1** favours fewer, smaller coefficients. **Masked hybrid PW ℓ1** declips as well: the clipped samples, and only they, are held at or above the clipping level and get the PW ℓ1 weighting. It does nothing when no clipping is found. **Source was dithered** widens how far each sample may move, from ±½ step to ±1 step. Turn it on when the sample was dithered on the way down. Mediante dithers (TPDF) when it stores a sample as 8-bit, unless its Depth is *8-bit, rounded* ([Instrument Properties](instrument-properties.md#sample-tab)). ## ANALYSE and the panel under it **ANALYSE** runs the detectors only — quick, and no solve — with the settings in the window, so the panel describes what Preview would work on. For each channel it shows the clip line (the clipping levels, as values and in dB), how much is clipped (frames, percentage, runs and the longest run), any tilt in the clip line, and the quantisation: the effective bit depth, the step, any gain applied after quantising, how many distinct values there are, and whether they sit on a grid. When declipping would be refused, the reason is shown instead: the region is silent or too quiet, holds too few distinct values or sits at its clipping level too much of the time to be anything but a synthetic wave, shows no clipping, or has no clip line that fits. ## Rail +, Rail − and Input bits **Rail +** and **Rail −** set the clipping levels by hand. Blank uses the detected ones, which show greyed in the boxes after an analysis. **Input bits** is the bit depth the restore works to: the size of a quantisation step when dequantising, and the step the Tolerance is counted in. Blank uses the sample's own depth, 8 or 16 — not the depth the analysis found, which shows greyed in the box; type that in to use it. ## The switches - **Crossfade into reliable** (on): fades the reconstruction into the good samples at the edges of each clipped run, instead of switching straight back to the original. The panel under the waveform says how many samples it moved — none with a solver that already holds the good samples to the original. - **Accept/reject per region** (on): puts the original back wherever the solve did not both raise the peak and add texture, and counts the regions kept and rejected. - **2× frequency oversampling** (on): zero-pads the transform to twice the window — a finer frequency grid, for near-periodic loops at arbitrary pitches. - **Debias pass**: an extra least-squares fit over the coefficients the ℓ1 solve kept, to give back the energy the shrinkage took. - **Input was resampled**: counts the two neighbours of every clipped sample as unreliable too, which is right when the file was resampled after it clipped. - **Ignore the square-wave guard**: declips anyway when the detectors say the region looks like a synthetic wave rather than clipping, or that no clip line fits. A refusal you can overrule is advice; accept/reject, when it is on, still applies. - **Tolerance** (2): how far below the clipping level still counts as clipped, in steps of the input depth. - **Window**: the transform length in samples; blank uses the preset's. It is rounded down to a power of two, at least 64, and no longer than the region. Crossfade, Accept/reject and Debias apply to Declip only. ## The waveform and the panel under it The dim curve is the region as it stands; the bright one is the preview. After a preview the panel gives the peak before and after, and the work done (iterations, the final residual, the time); a declip adds the clipped frames, the regions kept and rejected and what the crossfade did, a dequantise the bit depth and the prior. A result that peaks above full scale is not an error: the sample keeps it at full precision, and the instrument's **Clip** setting (hard or soft) decides how it plays. ## Preview, Audition and Apply **Preview** runs the solve, with a progress bar and a **Cancel**. Cancel stops on the next iteration when the page is cross-origin isolated, otherwise at the next channel, and the result is discarded either way. **Audition** plays the preview, or the region as it stands when there is none; **UNDO PREVIEW** and **REDO PREVIEW** step back and forth. **Apply** writes the preview into the sample, rendering one first if there is none, as one step of undo. It refuses when every channel was refused. The result is stored at 16-bit — except in an Amiga module, where an 8-bit sample stays 8-bit unless the Commands menu is set to return 16-bit — and kept at full precision either way.