How to Safely Exit Ecasound Interactive Mode

Exiting Ecasound's interactive mode properly is essential for preventing file corruption, especially when recording or processing uncompressed multi-track audio. This article explains the specific commands required to halt the audio processing engine safely, close audio file headers cleanly, and terminate an Ecasound interactive session without data loss.

The Safe Exit Command

To safely exit the Ecasound Interactive Mode (EIAI), the primary command is:

quit

You can also use the shorthand alias:

q

While typing quit automatically attempts to finalize processing, the safest procedure when recording or modifying audio files is to explicitly stop the engine before quitting. This two-step process guarantees all audio buffers flush to disk and container headers (such as RIFF headers in WAV files) update with the correct file length:

  1. Type stop and press Enter to halt the audio engine.
  2. Type quit (or q) and press Enter to close the session.
ecasound ('help' for list of commands)
> stop
> quit

Why Abrupt Exits Corrupt Audio Files

Audio file formats like WAV or AIFF store the total file size and data chunk length inside header metadata located at the beginning of the file. During live recording, Ecasound streams raw audio data into the file while keeping the final length undetermined.

When you issue the stop and quit commands, Ecasound seeks back to the start of the audio file to write the final header values before closing file descriptors.

If you exit the interactive session using interruption signals such as Ctrl+C, Ctrl+Z, or by killing the terminal process directly, Ecasound terminates before writing these header values. The resulting audio files often appear broken, unreadable, or will fail to open in digital audio workstations (DAWs) without manual header repair.