Mapping MIDI CC to LADSPA Filters in Ecasound

This guide explains the exact Ecasound syntax required to bind a physical MIDI controller knob to a LADSPA filter frequency for real-time sound processing. By using Ecasound’s built-in MIDI controller operator (-km), you can route continuous control change (CC) messages directly to LADSPA plugin parameters, establishing minimum and maximum frequency boundaries for dynamic hardware automation.

The -km Controller Syntax

In Ecasound, continuous parameter modulation from MIDI hardware is configured using the -km controller operator. The syntax is:

-km:fx_param,low_val,high_val,controller_number,midi_channel
  • fx_param: The 1-based parameter index of the LADSPA plugin you want to manipulate. For most single-filter plugins (such as lowpass_iir), the cutoff frequency is parameter 1.
  • low_val: The target frequency in Hertz when the MIDI knob is turned fully counter-clockwise (MIDI value 0).
  • high_val: The target frequency in Hertz when the MIDI knob is turned fully clockwise (MIDI value 127).
  • controller_number: The MIDI Continuous Controller (CC) number transmitted by your physical knob.
  • midi_channel: The MIDI channel transmitting the message (1–16).

Setting Up the LADSPA Filter

Before applying the controller, instantiate your filter with the -el (enable LADSPA) option:

-el:lowpass_iir,1000,2

In the lowpass_iir plugin, parameter 1 is the cutoff frequency in Hz (initially set to 1000 Hz), and parameter 2 is the number of filter stages.

Specifying the MIDI Device

To route physical MIDI data into Ecasound, define an ALSA sequencer MIDI input device using the -Md flag:

-Md:alsaseq,client:port

Replace client:port with your controller's ALSA port identification (obtained by running aconnect -l or amidi -l).

Complete Working Example

The following command takes real-time audio input from your soundcard, passes it through a LADSPA low-pass filter, outputs the audio back to your speakers, and maps MIDI CC #74 on channel 1 to sweep the filter cutoff frequency between 80 Hz and 12,000 Hz:

ecasound -i:alsahw,0,0 -o:alsahw,0,0 -el:lowpass_iir,1000,2 -km:1,80,12000,74,1 -Md:alsaseq,20:0
  • -i:alsahw,0,0: Captures input from ALSA device 0.
  • -o:alsahw,0,0: Plays output to ALSA device 0.
  • -el:lowpass_iir,1000,2: Loads the low-pass filter.
  • -km:1,80,12000,74,1: Maps parameter 1 (cutoff) from 80 Hz to 12,000 Hz using MIDI CC 74 on MIDI Channel 1.
  • -Md:alsaseq,20:0: Listens to the ALSA sequencer client 20:0 for incoming hardware control changes.