Can Ecasound Record Incoming Raw MIDI Streams?
This article examines whether the command-line audio processing tool Ecasound can record incoming raw MIDI streams simultaneously with multitrack audio. While Ecasound excels at multitrack audio recording, routing, and real-time effects processing, it has strict architectural limitations regarding MIDI data. Below is a breakdown of Ecasound's native MIDI capabilities, why it cannot directly capture raw MIDI tracks, and how to achieve synchronized audio and MIDI recording using standard Linux utilities.
The Direct Answer
No, Ecasound cannot natively record incoming raw MIDI data streams to
a file (such as a Standard MIDI File, .mid) alongside
multitrack audio.
Ecasound is designed fundamentally as an audio signal network. It reads, processes, and writes linear audio sample streams (PCM via ALSA, JACK, OSS, or audio files like WAV and FLAC). It does not contain an internal MIDI sequencer engine capable of capturing timestamped MIDI events, note messages, or raw binary SysEx streams into a track.
Ecasound's Actual MIDI Capabilities
Ecasound does interact with MIDI, but its MIDI support is strictly limited to control and synchronization:
- Real-time Controller Mapping: Ecasound can listen to incoming MIDI Continuous Controller (CC) messages to automate effect parameters, adjust volume sliders, or manipulate pan positions in real time.
- Transport Control: You can use external MIDI controllers (such as MMC - MIDI Machine Control or specific note triggers) to start, stop, and cue the Ecasound engine.
- MIDI Clock: Ecasound can emit or sync to MIDI clock pulses to keep external hardware or software aligned with its audio playback or recording timeline.
None of these subsystems write incoming MIDI notes, pitch bends, or controller events to disk for later playback or editing.
How to Record MIDI and Audio Simultaneously
To record raw MIDI streams alongside multitrack audio managed by Ecasound, you must run a dedicated MIDI recording utility in parallel. In a Linux environment, this is achieved through ALSA or JACK synchronization.
Method 1: Using
arecordmidi with ALSA
For ALSA-based setups, run arecordmidi alongside your
Ecasound command:
- Identify your MIDI hardware or virtual port using
arecordmidi -l. - Launch
arecordmiditargeted to that port to output a standard.midfile. - Simultaneously start your Ecasound audio capture chain.
You can trigger both concurrently using a basic shell script:
#!/bin/sh
# Start MIDI capture in the background
arecordmidi -p 24:0 my_midi_track.mid &
MIDI_PID=$!
# Start Ecasound multitrack audio recording
ecasound -c -f:s16_le,2,44100 \
-a:1 -i alsa,hw:0,0 -o track1.wav \
-a:2 -i alsa,hw:0,1 -o track2.wav
# Terminate MIDI capture when Ecasound exits
kill $MIDI_PIDMethod 2: Using JACK Transport
If precise sample-accurate synchronization between the audio and MIDI streams is required, use JACK Audio Connection Kit:
- Configure Ecasound to use JACK for both audio inputs and transport
control (
ecasound -G:jack ...). - Use a dedicated JACK MIDI recorder, such as
jack_capture(for audio) paired withjack-keyboard/mididingssetups, or lightweight command-line MIDI recorders likejack_midi_dumpornon-timeline. - When the JACK Transport starts, both Ecasound and your chosen MIDI capture utility will roll simultaneously, keeping tracks aligned.