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:
- The Filter Operator: The effect processing the audio (such as a low-pass or resonant filter).
- 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:
-efl:cutoff(Low-pass filter): Cutoff frequency in Hz is parameter1.-ef3:cutoff:resonance:gain(Resonant low-pass filter): Cutoff frequency in Hz is parameter1, resonance is parameter2.-efh:cutoff(High-pass filter): Cutoff frequency in Hz is parameter1.
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
fx_param: The index of the parameter being controlled (usually1for cutoff).channel: The audio channel to apply modulation to (typically1for mono or all channels depending on setup).start_value: The initial cutoff frequency in Hz.end_value: The final cutoff frequency in Hz.duration: The time in seconds over which the transition occurs.
Example Command: Linear Cutoff Sweep
ecasound -i input.wav -o output.wav -efl:500 -klg:1:1:200:5000:10In 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
file: Path to a plain text file containing space- or newline-separated floating-point values representing the desired cutoff frequencies over time.control_rate: The frequency (in updates per second / Hz) at which Ecasound reads the next value from the file.
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:50Cyclic
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:0This 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).