How Effects Work

From Audacity Wiki
Jump to: navigation, search

This page, for developers, describes how effects in Audacity work.

Oh, we also describe how generators work too.

Noise Reduction

The effect creates a custom filter, based on the spectrum of the noise. The wiki page explains more detail and why there can be a 'tinkly-bells' artifact. For details see this page

Chirp and Tone

The generator modifies a sine wave. The wiki page describes why things are a bit more complex with generating a square wave, and how very long chirps and tones are generated.

Truncate Silence

The effect has first to detect silence, not as obvious a thing as it sounds at first. For our purposes silence is not necessarily a flat-line. We may have low energy low frequency sounds - including as a special case DC bias. Having detected it, removing it is not as obvious as you might think. Doing it wrong can lead to clicks.

Change Tempo

This effect changes the speed of audio without changing the pitch. It uses the SoundTouch library. It removes cycles of audio, using a best match (autocorrelation) to decide how much to slide the audio.


Amplify is just multiplication of each sample by a constant. The most interesting code in the effect is for the UI, where the UI computes the maximum amplification that can be applied without clipping. Rather than examine every single sample to do this, it re-uses the code used for fast drawing of waveforms which keeps a cache of the minimum and maximum values of audio over a particular range. Umm... I'm not sure if this is true, but it is what it should do, isn't it?


An interesting wrinkle here is that the effect re-uses the same blockfiles multiple times.

Click Removal

The tool looks for short, abrupt discontinuities (known as "spikes") in the waveform, typical of those produced by a click on a record. Click Removal then interpolates the samples either side of the click to reconstruct the waveform. However, it's common sense not to rely exclusively on digital sound processing to clean up noisy records. Where possible, have the records professionally cleaned, or use your own cleaning methods. The Click Removal algorithm consists of two parts:

  • The first part, click detection, works by measuring the amplitude of the sound in each small piece of the selected sound, and comparing it to the average amplitude in surrounding pieces. Short pieces of sound that are much louder than the region before or after might be spikes. (The threshold slider bar sets the square of the required ratio between the amplitudes inside and outside the loud section). Pieces of extra-loud sound that are shorter than the max spike width (measured in milliseconds) are marked for removal. This technique works well for vinyl record pops and clicks because it catches oscillations (not just single spikes). Electronic spikes typically drive the speaker in just one direction, but LP pops are harder to find because they often contain oscillation as the stylus and cartridge settle back down after the initial hit of the dust mote, groove gouge, or whatever.
  • The second part click removal, replaces the marked segment of sound. This part of the algorithm is pretty simple-minded -- it tries to make the audio samples move smoothly across from the position before the pop to the position after the pop. This may have the effect of creating a very short, hopefully not-very-noticeable silence in the track where before there was a loud click.