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:

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_value

Example: Modulating a Low-Pass Filter

ecasound -i:input.wav -Md:alsaseq,128:0 -efl:1000 -km:1,1,74,200,8000 -o:alsa

In this command:

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,5

Logarithmic 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,duration

Example mapping a frequency rise over 8 seconds:

-efl:200 -klg:1,200,10000,8

Custom 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,column

The 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:

  1. Audio Buffering: Set lower buffer sizes using -B:audio_buffer_size (e.g., -b:128 or -b:256) to minimize the control-rate latency between a physical MIDI movement and the resulting parameter update.
  2. MIDI Subsystem: Specify the proper MIDI device driver using -Md:device_type,device_name. Use alsaseq for virtual software patching or rawmidi (e.g., /dev/snd/midiC1D0) for dedicated hardware interfaces.