Ecasound MIDI Dynamic Parameter Modulation
Dynamic parameter modulation in Ecasound allows you to automate effects and alter audio parameters in real time using MIDI continuous controllers and predefined envelope curves. This guide details how to assign MIDI controls to effect operators, configure scaling curves, and apply envelopes using Ecasound’s native command-line syntax.
The Ecasound Controller Architecture
Ecasound modifies audio parameters using "controllers" attached to "operators" (such as filters, amplifiers, or panning). Operators are indexed per chain, and their internal parameters are numbered starting from 1.
To modulate these parameters, Ecasound provides several controller types:
-km: MIDI continuous controller (maps hardware MIDI messages to an operator parameter).-kl/-kl2: Linear envelope curves over time.-klg: Logarithmic envelope curves.-kf: Custom envelope curves loaded from an external text file.
Mapping MIDI CC to
Dynamic Parameters (-km)
The standard way to dynamically modulate an effect parameter using
MIDI is the -km controller. Its syntax binds an incoming
MIDI Continuous Controller (CC) to a targeted effect parameter and maps
the standard 0–127 MIDI range to a specified numerical range.
-km:fx_param,midi_channel,controller_number,min_value,max_valuefx_param: The parameter index of the target operator (e.g.,1for the cutoff frequency in a resonant low-pass filter).midi_channel: The MIDI channel (1–16).controller_number: The MIDI CC number (e.g.,1for Modulation Wheel,7for Volume,74for Filter Brightness).min_value: The minimum parameter value output when the MIDI CC is at0.max_value: The maximum parameter value output when the MIDI CC is at127.
Example: Modulating a Low-Pass Filter
ecasound -i:input.wav -Md:alsaseq,128:0 -efl:1000 -km:1,1,74,200,8000 -o:alsaIn this command:
-Md:alsaseq,128:0routes MIDI input from ALSA sequencer port 128:0.-efl:1000inserts a low-pass filter with an initial cutoff of 1000 Hz.-km:1,1,74,200,8000maps MIDI CC 74 on Channel 1 to operator parameter 1 (cutoff frequency), scaling the input from 200 Hz to 8000 Hz.
Combining Time-Based Envelope Curves with Modulation
When automation curves are required alongside or in place of real-time manual MIDI input, Ecasound uses automated envelope generators.
Linear Envelopes
(-kl and -kl2)
Linear envelopes ramp an operator's parameter between specified points over time:
# Ramps parameter 1 from 200 to 5000 over 10 seconds:
-kl:1,200,5000,10
# Multi-stage envelope: ramps from 200 to 4000 in 5s, then down to 1000 in 5s:
-kl2:1,200,4000,1000,5,5Logarithmic Curves
(-klg)
For parameters where perception is non-linear (such as frequency or volume), logarithmic envelopes provide natural-sounding sweeps:
-klg:fx_param,start_value,end_value,durationExample mapping a frequency rise over 8 seconds:
-efl:200 -klg:1,200,10000,8Custom Multi-Point
Envelopes via Files (-kf)
For complex modulation curves that follow non-standard shapes,
envelope data can be stored in an external ASCII text file and bound
using -kf.
-kf:fx_param,filename,columnThe envelope text file must contain time-stamped key-value pairs formatted as:
0.0 200
2.5 1500
3.0 800
10.0 12000
Ecasound interpolates values between the defined timestamps, allowing continuous, high-resolution parameter sweeps matching pre-arranged modulation patterns.
Real-Time Routing Considerations
To ensure low-latency response when using MIDI controllers to manipulate envelope ranges or direct parameters:
- Audio Buffering: Set lower buffer sizes using
-B:audio_buffer_size(e.g.,-b:128or-b:256) to minimize the control-rate latency between a physical MIDI movement and the resulting parameter update. - MIDI Subsystem: Specify the proper MIDI device
driver using
-Md:device_type,device_name. Usealsaseqfor virtual software patching orrawmidi(e.g.,/dev/snd/midiC1D0) for dedicated hardware interfaces.