schema_version: 7.0
type: transition
identifier: mix
title: Mix
version: 2
copyright: Meltytech, LLC
creator: Dan Dennedy
license: LGPLv2.1
language: en
tags:
  - Audio
description: Mix two audio tracks.
bugs:
  - Samples from the longer of the two frames are discarded.
parameters:
  - identifier: start
    title: Start
    argument: yes
    type: float
    mutable: yes
    description: >
      The mix level to apply to the second frame. -1 causes an automatic
      linear crossfade from 0 to 1. -2 causes an automatic constant-power
      (equal-power) crossfade from 0 to 1.

  - identifier: end
    title: End
    type: float
    mutable: yes
    description: >
      The ending value of the mix level. Mix level will be interpolated from
      start to end over the in-out range.

  - identifier: reverse
    title: Reverse
    type: boolean
    mutable: yes
    description: >
      Set to 1 to reverse the direction of the mix.
    default: 0
    widget: checkbox

  - identifier: combine
    title: Use an alternative mixing algorithm
    description: >
      Mix using a low pass filter to prevent affecting audio levels. However,
      this may introduce slight artifacts.
      This is incompatible with start < 0.
    type: boolean
    default: 0
    mutable: yes

  - identifier: sum
    title: Mix by simply adding samples
    description: >
      The default mixing algorithm halves the sample values before adding them
      to absolutely prevent clipping. However, that affects levels. This
      algorithm simply adds samples and may clip. In many real world scenarios,
      the signals being mixed typically have headroom in their level and are
      rarely correlated and thus often will not clip. Also, one can reduce the
      gain and add a limiter on the mixed output prior to integer quantization
      to prevent clipping.
      This mode is incompatible with start < 0.
    type: boolean
    default: 0
    mutable: yes
