Ecasound MIDI Disconnection in Live Performance

When a MIDI controller is physically disconnected during a live performance, Ecasound’s response is dictated by its chosen audio/MIDI subsystem interface—specifically RawMIDI, the ALSA Sequencer, or JACK MIDI. While Ecasound excels at lightweight, low-latency signal routing, it does not natively feature dynamic plug-and-play recovery. Depending on the configuration, an unplugged device will either trigger an unrecoverable input/output error that halts the entire engine, or result in silent failure where processing continues uninterrupted while waiting for the missing stream.

RawMIDI Interface Failures

If Ecasound is configured to read directly from a device node using the raw MIDI input module (e.g., -i:rawmidi,/dev/snd/midiC1D0), a hardware disconnection causes an immediate critical failure. The Linux kernel closes or invalidates the underlying character device node, triggering an ENODEV (No such device) or EIO (Input/output error) system error on the next read operation. Ecasound's processing loop treats this as a fatal streaming fault, stopping the engine and exiting the live session to prevent infinite error cycling.

ALSA Sequencer Behavior

Using the ALSA sequencer subsystem (-i:alsaseq,port-id) provides a layer of isolation between the physical port and Ecasound. When a controller is disconnected:

  • The kernel-level ALSA sequencer automatically tears down the sender port.
  • The logical subscription between the hardware port and Ecasound’s ALSA client breaks.
  • Ecasound does not crash; instead, its input buffer stops receiving MIDI events, resulting in silent dropped control signals.
  • If the device is reconnected to the system, Ecasound will not automatically detect it. The newly assigned ALSA port requires an external reconnect command (via aconnect or an ALSA patchbay) to restore communication.

JACK MIDI Abstraction

Running Ecasound inside a JACK Audio Connection Kit environment provides the highest resilience for live performances. JACK decouples physical hardware from client ports by routing MIDI signals through virtual software endpoints:

  • If hardware disconnects, the JACK server manages the hardware drop, leaving Ecasound’s virtual JACK MIDI input port alive and functional.
  • The main audio and MIDI processing loop remains entirely unaffected, avoiding dropouts, engine crashes, or audio buffer under-runs.
  • Using session managers or tools like jack-plumbing allows automatic reconnection as soon as the hardware device is plugged back in, restoring control transparently without restarting Ecasound.

To avoid total session failure from loose cables or USB dropouts:

  1. Never use RawMIDI in live environments: Direct hardware access lacks fault isolation.
  2. Utilize JACK MIDI or a2jmidid: Decoupling ensures that sudden hardware changes do not terminate the underlying Ecasound process.
  3. Automate Reconnection: Employ background utilities such as udev rules paired with connection scripts to re-bind the device to Ecasound's sequencer ports automatically upon reconnection.