Skip to main content

mix

mix(
@buffers ? ## list/llll (required)
@gains null
@offsets null
@resamplingfiltersize 11
@resamplingmode 'sinc'
@resamplingpolicy 3
@ampunit 0
@envampunit 0
@timeunit 0
@envtimeunit 2
@interp 0
@normalize 0
) -> llll

Generates an audio process operation for mixing multiple buffers.


Arguments

  • @buffers ? [list/llll]: list of buffers to mix. (required)
  • @gains [list/llll/null]: gain values for each buffer to mix, as either a single number or envelope. (default: null).
  • @offsets [list/null]: time offset values for each buffer to mix. (default: null).
  • @resamplingfiltersize [int]: resampling filter size. (default: 11).
  • @resamplingmode [symbol]: resampling mode. (default: 'sinc').
    • 'sinc'
    • 'nearest neighbor'
    • 'sample and hold'
    • 'linear'
    • 'quad'
    • 'cubic'
  • @resamplingpolicy [int]: resampling policy. (default: 3).
    • 0: don't
    • 1: to lowest
    • 2: to highest
    • 3: to most common
    • 4: to max. current
  • @ampunit [int]: amplitude unit. (default: 0).
    • 0: linear
    • 1: decibels
  • @envampunit [int]: envelope amplitude unit. (default: 0).
    • 0: linear
    • 1: decibels
  • @timeunit [int]: time unit. (default: 0).
    • 0: milliseconds
    • 1: samples
    • 2: duration ratio
    • 3: milliseconds difference
    • 4: samples difference
  • @envtimeunit [int]: envelope time unit. (default: 2).
    • 0: milliseconds
    • 1: samples
    • 2: duration ratio
    • 3: milliseconds difference
    • 4: samples difference
  • @interp [int]: band-limited interpolation via resampling for non-integer offsets. (default: 0).
    • 0: off
    • 1: on
  • @normalize [int]: normalization. (default: 0).
    • 0: never
    • 1: always
    • 2: overload protection only

Output

mix operation [llll]


Usage

mix is meant to be used with the process function:

$buffer = importaudio('singing.wav'); ## input buffer
$op = mix(
@buffers importaudio('guitar.wav') importaudio('drums.wav')
); ## processing operation
$buffer = $buffer.process($op); ## apply processing
$buffer.inspect('after mix process')