Modulating Filter Cutoff Using Ecasound Envelopes

This article explains how to automate and modulate filter cutoff frequencies over time using control envelopes in Ecasound. By connecting Ecasound's dynamic controller operators to specific filter parameters, users can create time-varying audio effects such as sweeps, wobbles, and evolving textures directly from the command line or within chainsetup scripts.

Understanding Ecasound Control Architecture

Ecasound applies audio processing using chain operators (-e*), where each operator has numbered parameters that govern its behavior. To modulate a parameter dynamically instead of keeping it static, Ecasound provides controllers (-k*). Controllers run parallel to the audio stream and continuously update target parameter values at a specified control rate.

When modulating a filter's cutoff frequency, two components work together:

  1. The Filter Operator: The effect processing the audio (such as a low-pass or resonant filter).
  2. The Controller Operator: The envelope or modulation source that alters the filter's cutoff parameter index over time.

Identifying Filter Parameters

Before attaching a controller, you must identify the index of the parameter you wish to automate. For example:

Modulating with Linear Envelope Controllers (-klg)

To sweep a cutoff frequency linearly from a start value to an end value over a specific duration, use the linear envelope controller -klg.

The syntax is:

-klg:fx_param:channel:start_value:end_value:duration

Example Command: Linear Cutoff Sweep

ecasound -i input.wav -o output.wav -efl:500 -klg:1:1:200:5000:10

In this command, -efl:500 initializes a low-pass filter, and -klg:1:1:200:5000:10 overrides parameter 1, smoothly raising the cutoff frequency from 200 Hz to 5000 Hz over the first 10 seconds of playback.

Continuous Envelopes via External Control Files (-km)

For complex, multi-stage envelope shapes (such as attack-decay curves or rhythmic patterns), Ecasound supports reading control values from text files using the continuous controller operator -km.

The syntax is:

-km:fx_param:channel:file:control_rate

If a file named cutoff_curve.txt contains envelope values sampled at 50 Hz, it can be assigned to the filter like this:

ecasound -i input.wav -o output.wav -ef3:1000:0.8:1.0 -km:1:1:cutoff_curve.txt:50

Cyclic Envelope Modulation Using Oscillators (-kos)

When periodic modulation (such as an LFO envelope) is required rather than a one-shot ramp, the sine-wave controller -kos or logarithmic sine controller -kos2 can be used:

-kos:fx_param:channel:freq:min_value:max_value:initial_phase

Example Command: LFO Filter Sweep

ecasound -i input.wav -o output.wav -efl:1000 -kos:1:1:0.5:300:3000:0

This applies a low-pass filter where parameter 1 (cutoff) oscillates continuously between 300 Hz and 3000 Hz at a rate of 0.5 Hz (one complete cycle every two seconds).