FX INTRODUCTION / 08 / DRAFT

Envelope Follower: track signal strength

Before moving on to Gate and Compressor, turn input amplitude into a smooth control value.

This article is a work in progress. The examples will be refined through listening. Run starts playback; Stop ends it. Use Apply after editing values. Stop the playing iframe before trying another one.

There is no standalone built-in Envelope Follower effect. To prepare for Gate and Compressor, this liveFx experiment tracks signal level and uses it to change loudness.

How the PCM is processed

Take absolute values to fold negative values upward, then smooth them. Use the Attack time constant while rising and Release while falling. This differs from short-term RMS detection. Using the maximum of the left and right channels avoids image movement caused by independent channel gains.

input[ch][i] is one input sample. ch identifies a left or right audio channel, not a physical FM voice. Store values carried between blocks in state. Since process cannot access outer variables, put settings in context.

Try it with liveFx

The 48000 in context.sampleRate is a placeholder. Match it to the actual output rate shown in FX Monitor. It is used to calculate times and frequencies; it does not change the browser's output sample rate.

Open in a separate Playground tab ↗

Select envelope-follower-lab in FX Monitor to compare the input and output of this process.

  1. Set mix to 0 to hear the original. At 1, check whether quieter portions of the decay become even quieter.
  2. Set attackMs to 100 to make tracking of the onset slower.
  3. Compare releaseMs at 30 and 500 and listen to changes during decay.

Scope of this example

There is no standalone built-in Envelope Follower API. This demo uses the detected value as a gain. FX Monitor displays the processed audio, not state.envelope itself. The control value is not written directly to the audio output.

The waveform shows changes over time; Spectrum shows the strength of frequency components. A short display window or smoothing can hide some changes. Listen while changing one setting at a time.