Audio Operators

The following operators can be applied to an audio stream:

OperatorTypeDescription
volumenumberSets the linear gain of an input or output stream.
mixarrayLists the input streams mixed into an output stream.

volume

Sets the linear gain of an audio stream. A linear gain of 1.0 represents a logarithmic gain of 0 dB. Linear and logarithmic gains are related as follows:

dB = 20.0 * log10 (volume), volume = pow10 (dB / 20.0)

mix

Combines multiple audio streams. Each element of the array supports the following properties:

PropertyTypeDescription
namestringIdentifies the input stream.
levelnumberNormalized linear gain applied to all input stream channels. A value of 1.0 represents 0 dB gain.
phasenumberRotation applied to all input channels in degrees (0, 90, -90 or 180).
channelarrayLists the input channels mixed into each output channel. The output stream channels property determines the dimension of the array.

The array items are either the input channel number (1 based) or a channel object as described below.

The channel object identifies a specific input channel. The object supports the following properties:

PropertyTypeDescription
channelintegerIdentifies the input channel by number (1 based).
labelenumIdentifies the input channel by speaker label.
programintegerIdentifies the input channel by program number.
levelnumberNormalized linear gain applied to the input channel. A value of 1.0 represents 0 dB gain.
phasenumberRotation applied to the input channel in degrees (0, 90, -90 or 180).

The phase property applies a phase rotation (in 90 degree increments) and can be applied to a stream or a specific channel. For example the standard Dolby ProLogic down mix is implemented as follows:

---
input:
  container:
  - name: input1
    audio:
    - name: surround
      channels: 6
      label:
      - L
      - R
      - C
      - LFE
      - Ls
      - Rs
output:
  container:
  - name: output1
    type: 'mp4 '
    audio:
    - name: stereo
      channels: 2
      mix:
      - name: surround
        channel:
        - label: L
        - label: R
      - name: surround
        level: 0.707107
        channel:
        - label: C
        - label: C
      - name: surround
        level: 0.707107
        channel:
        - label: LFE
        - label: LFE
      - name: surround
        phase: -90
        channel:
        - label: Ls
          level: 0.87178
        - label: Ls
          level: 0.489898
      - name: surround
        phase: 90
        channel:
        - label: Rs
          level: 0.489898
        - label: Rs
          level: 0.87178
{
  "input": {
    "container": [
      {
        "name": "input1",
        "audio": [
          {
            "name": "surround",
            "channels": 6,
            "label": [
              "L",
              "R",
              "C",
              "LFE",
              "Ls",
              "Rs"
            ]
          }
        ]
      }
    ]
  },
  "output": {
    "container": [
      {
        "name": "output1",
        "type": "mp4 ",
        "audio": [
          {
            "name": "stereo",
            "channels": 2,
            "mix": [
              {
                "name": "surround",
                "channel": [
                  {
                    "label": "L"
                  },
                  {
                    "label": "R"
                  }
                ]
              },
              {
                "name": "surround",
                "level": 0.707107,
                "channel": [
                  {
                    "label": "C"
                  },
                  {
                    "label": "C"
                  }
                ]
              },
              {
                "name": "surround",
                "level": 0.707107,
                "channel": [
                  {
                    "label": "LFE"
                  },
                  {
                    "label": "LFE"
                  }
                ]
              },
              {
                "name": "surround",
                "phase": -90,
                "channel": [
                  {
                    "label": "Ls",
                    "level": 0.87178
                  },
                  {
                    "label": "Ls",
                    "level": 0.489898
                  }
                ]
              },
              {
                "name": "surround",
                "phase": 90,
                "channel": [
                  {
                    "label": "Rs",
                    "level": 0.489898
                  },
                  {
                    "label": "Rs",
                    "level": 0.87178
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}