Ecasound MIDI Clock Sync with Hardware Sequencers
Ecasound coordinates playback and recording with external hardware sequencers primarily through MIDI Machine Control (MMC), MIDI Time Code (MTC), and the JACK Audio Connection Kit ecosystem. While Ecasound is engineered fundamentally as a multitrack digital audio processor rather than a dedicated MIDI sequencer, it provides specialized input and output interfaces that allow users to align audio playback precisely with external hardware tempo and transport commands.
MIDI Clock vs. Transport Control
To understand synchronization in Ecasound, it is necessary to distinguish between transport control and tempo-based clock synchronization:
- MIDI Beat Clock: Consists of 24 timing tick messages per quarter note (PPQN) designed to keep tempo and tempo changes in lockstep.
- MIDI Machine Control (MMC) and MIDI Time Code (MTC): Used for absolute positioning (hours, minutes, seconds, frames) and basic transport states (play, pause, stop, locate).
Ecasound natively excels at absolute time tracking (MTC/MMC) and external audio clocking rather than generating continuous 24 PPQN MIDI Beat Clock streams directly. Consequently, synchronization with external hardware sequencers is generally achieved using one of two primary approaches: direct ALSA MIDI transport integration or the JACK Audio Connection Kit.
Method 1: Using the JACK Audio Connection Kit
The most robust and timing-accurate way to synchronize Ecasound with external hardware sequencers is through JACK Transport. In this setup, JACK functions as the master or slave clock authority, while an intermediary tool handles the generation of 24 PPQN MIDI clock pulses.
- Routing Audio via JACK: Launch Ecasound configured
to use the JACK audio subsystem for input and output:
ecasound -i:jack -o:alsa -c - Synchronizing Transport: Ecasound automatically links its internal engine position to JACK Transport when using JACK inputs or outputs, allowing it to start, stop, and relocate synchronously.
- Generating MIDI Clock: Use a specialized bridge
utility, such as
jack_midi_clockor a lightweight sequencer likeseq24, to translate JACK Transport position and tempo into hardware-compliant MIDI Clock pulses sent directly to your external hardware's physical MIDI DIN or USB port.
Method 2: ALSA MIDI Machine Control (MMC)
If your external hardware sequencer supports MMC, Ecasound can listen for incoming transport commands directly through the ALSA sequencer subsystem without third-party translation tools.
- Controller Flag: Use the
-Moption within Ecasound to designate an ALSA MIDI port for control. - Syntax Example:
In this mode, Ecasound binds to an ALSA sequencer port (e.g.,
ecasound -c -M:alsaseq,128:0 -i:audio.wav -o:alsa128:0). When the external hardware sequencer transmits start, stop, or locate messages via MMC, Ecasound intercepts these events and synchronizes its audio stream playback accordingly.
Latency and Drift Compensation
Audio buffers and hardware MIDI interfaces introduce processing latency. When locking Ecasound with an external sequencer:
- Buffer Tuning: Keep Ecasound's buffer size minimal
using the
-b:buffersizeoption to reduce audio playback start latency. - Position Offsets: Use Ecasound’s interactive mode
(
cs-set-position) or preset positioning flags to fine-tune alignment between the analog audio and the hardware sequencer's output. - Sample Rate Stability: Ensure that the audio interface running Ecasound shares a common clock reference with any digital audio streams originating from the external hardware synth or sequencer to prevent drift over extended recording sessions.