How to Bind MIDI Controllers in Ecasound

Ecasound enables real-time parameter manipulation using external hardware via MIDI continuous controller (CC) messages. This guide covers the exact command-line syntax used to connect an external MIDI input device and bind specific MIDI CC knobs, sliders, or pedals to chain operator parameters within an Ecasound processing session.

The MIDI Binding Syntax: -km

In Ecasound, continuous parameter controllers are attached to the preceding chain operator using the -km option. The basic syntax is:

-km:param_id,midi-channel,controller-id,lower-bound,upper-bound

The parameters are defined as follows:

  • param_id: The numeric index of the effect parameter you want to automate. For example, in an amplify operator (-ea:100), parameter 1 corresponds to the amplification percentage.
  • midi-channel: The MIDI channel to listen on (typically 1 to 16).
  • controller-id: The continuous controller number (CC 0 to 127) transmitted by your hardware (e.g., CC 7 for volume, CC 1 for modulation wheel).
  • lower-bound: The minimum value assigned to the target parameter when the MIDI controller sends its minimum value (0).
  • upper-bound: The maximum value assigned to the target parameter when the MIDI controller sends its maximum value (127).

Defining the MIDI Input Device: -Md

Before Ecasound can read continuous controller messages, you must register your hardware device using the global MIDI device flag -Md.

For ALSA sequencer connections:

-Md:alsaseq,default

For raw MIDI devices:

-Md:rawmidi,/dev/midi00

Complete Command-Line Example

The following command routes audio from an ALSA input to an ALSA output across a chain named main, adds an amplification operator (-ea), and maps MIDI CC 7 on channel 1 to control the volume level between 0% and 200%:

ecasound -Md:alsaseq,default -a:main -i:alsa,default -o:alsa,default -ea:100 -km:1,1,7,0,200

In this command:

  • -Md:alsaseq,default opens the ALSA sequencer MIDI subsystem.
  • -a:main creates and selects chain main.
  • -i:alsa,default -o:alsa,default assigns the audio input and output.
  • -ea:100 applies an amplifier operator initialized at 100%.
  • -km:1,1,7,0,200 binds parameter 1 of -ea to MIDI Channel 1, CC 7, scaling values from 0 to 200.

After launching, you can use ALSA utilities like aconnect to connect your physical MIDI controller port to Ecasound's sequencer port if it is not routed automatically.