View Source Membrane.AudioMixer (Membrane Audio Mix plugin v0.12.0)

This element performs audio mixing.

Audio format can be set as an element option or received through stream_format from input pads. All received stream_format have to be identical and match ones in element option (if that option is different from nil).

Input pads can have offset - it tells how much silence should be added before first sample from that pad. Offset has to be positive.

Mixer mixes only raw audio (PCM), so some parser may be needed to precede it in pipeline.

element-options

Element options

Passed via struct Membrane.AudioMixer.t/0

  • stream_format

    RawAudio.t()

    Default value: nil
    The value defines a raw audio format of pads connected to the element. It should be the same for all the pads.

  • frames_per_buffer

    pos_integer()

    Default value: 2048
    Assumed number of raw audio frames in each buffer. Used when converting demand from buffers into bytes.

  • prevent_clipping

    boolean()

    Default value: true
    Defines how the mixer should act in the case when an overflow happens.

  • native_mixer

    boolean()

    Default value: false
    The value determines if mixer should use NIFs for mixing audio. Only clip preventing version of native mixer is available. See Membrane.AudioMixer.NativeAdder.

  • synchronize_buffers?

    boolean()

    Default value: false
    The value determines if mixer should synchronize buffers based on pts values.

    • If true, mixer will synchronize buffers based on its pts values. If buffer pts value is lower then the current mixing time (last_ts_sent) it will be dropped.
    • If false, mixer will take all incoming buffers no matter what pts they have and put it in the queue.

pads

Pads

input

:input

Accepted formats:

%RawAudio{sample_format: sample_format} when sample_format in [:s8, :s16le, :s16be, :s24le, :s24be, :s32le, :s32be]
Membrane.RemoteStream
Direction::input
Availability::on_request
Mode::pull
Demand mode::manual
Demand unit::bytes

Pad options:

  • offset

    Time.non_neg_t()

    Default value: 0
    Offset of the input audio at the pad.

output

:output

Accepted formats:

RawAudio
Direction::output
Availability::always
Mode::pull
Demand mode::manual

Link to this section Summary

Types

Options for pad :input

t()

Struct containing options for Membrane.AudioMixer

Functions

Returns description of options available for this module

Link to this section Types

@type input_pad_opts_t() :: [{:offset, Membrane.Time.non_neg_t()}]

Options for pad :input

@type t() :: %Membrane.AudioMixer{
  frames_per_buffer: pos_integer(),
  native_mixer: boolean(),
  prevent_clipping: boolean(),
  stream_format: Membrane.RawAudio.t(),
  synchronize_buffers?: boolean()
}

Struct containing options for Membrane.AudioMixer

Link to this section Functions

@spec options() :: keyword()

Returns description of options available for this module