Route ALSA to JACK Simultaneously Using Ecasound

This article explains how to route audio directly from an Advanced Linux Sound Architecture (ALSA) input to a JACK Audio Connection Kit output simultaneously using Ecasound. Ecasound's modular architecture allows it to interface with different audio subsystems at the same time, making it an effective lightweight bridge between standard ALSA hardware devices and the low-latency JACK audio graph. Below is a direct guide on how this works, the exact commands required, and key synchronization considerations to prevent audio glitches.


Can Ecasound Do This?

Yes. Ecasound natively supports routing audio from an ALSA input to a JACK output in a single, simultaneous process. Because Ecasound treats inputs and outputs as independent modular streams, it can pull audio from an ALSA hardware node, process it in an internal buffer, and stream it directly to a running JACK server without requiring extra virtual loopback devices.

Basic Command Syntax

To start routing immediately, open your terminal and run the following command while your JACK server is already active:

ecasound -i alsa,default -o jack

This captures from your default ALSA device and creates corresponding output ports in JACK.

To specify exact hardware devices and route them into specific JACK destinations, define the hardware address and JACK client options explicitly:

ecasound -i alsa,hw:1,0 -o jack_generic,ecasound_out

Parameter Breakdown

Full Production Example

When running cross-subsystem routing, matching sample formats and defining buffer sizes ensures reliable audio transmission:

ecasound -B:rt -b:512 -f:f32_le,2,48000 -i alsa,hw:1,0 -o jack_multi,system:playback_1,system:playback_2

In this setup:

Critical Considerations: Clock Drift and Resampling

  1. Sample Rates: The ALSA device and the JACK server must operate at the same sample rate (commonly 44,100 Hz or 48,000 Hz). If they differ, add Ecasound's resampling filter or reconfigure JACK, otherwise pitch shifting or crackling will occur.
  2. Clock Drift: Because the ALSA input runs on the physical clock of the input hardware and JACK runs on the clock of the chosen JACK master hardware device, the two audio clocks can slowly drift over long sessions. For mission-critical, multi-hour recording or playback, consider using a dedicated resampler like zita-a2j or synchronizing hardware via word clock. For typical streaming and playback tasks, Ecasound's standard buffering handles the transfer reliably.