Export Multitrack Mixdown to FLAC in Ecasound

This article explains how to combine multiple audio tracks into a single mixdown and export them directly to a compressed FLAC file using the Ecasound command-line utility. By assigning individual inputs to separate audio chains and routing those chains into a single FLAC output, you can complete the entire rendering process in a single command without creating intermediate uncompressed files.

Basic Command Syntax

To export a multitrack mixdown directly to FLAC, assign each input track to its own chain, then attach all active chains to a single .flac output file.

ecasound -a:1 -i track1.wav -a:2 -i track2.wav -a:all -o mixdown.flac

Syntax Breakdown

  • -a:1, -a:2: Defines individual signal chains. Each input track must reside on a separate chain to prevent them from overwriting one another.
  • -i track1.wav: Specifies the audio input source for the currently selected chain. Ecasound supports various source formats, including WAV, AIFF, and FLAC.
  • -a:all: Selects all previously defined chains (chains 1 and 2 in this case).
  • -o mixdown.flac: Designates the output target. Because -a:all precedes it, Ecasound mixes the audio from all selected chains down into this destination. Ecasound uses libsndfile automatically to encode the stream directly to FLAC based on the .flac extension.

Advanced Multitrack Example with Audio Formatting

If your source files vary in channel count or sample rate, specify the audio format explicitly to ensure proper mixing:

ecasound -f:s24_le,2,44100 \
  -a:1 -i track1.wav \
  -a:2 -i track2.wav \
  -a:3 -i track3.wav \
  -a:all -o mixdown.flac
  • -f:s24_le,2,44100: Sets the audio format across the signal chain. In this example, it enforces 24-bit little-endian signed integer samples (s24_le), stereo output (2), and a 44.1 kHz sampling rate (44100).

Balancing Track Levels Before Mixdown

To adjust the volume of individual tracks prior to the mixdown, apply the amplify preset (-ea) to individual chains:

ecasound \
  -a:1 -i drums.wav -ea:100 \
  -a:2 -i bass.wav -ea:85 \
  -a:3 -i vocals.wav -ea:110 \
  -a:all -o mixdown.flac

The -ea:<percentage> option adjusts the gain for that specific chain before the signals are summed into the final FLAC file.