View Source Membrane.AudioMixer (Membrane Audio Mix plugin v0.9.0)
This element performs audio mixing.
Audio format can be set as an element option or received through caps from input pads. All
received caps 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
caps
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.- If true, the wave will be scaled down, so a peak will become the maximal
value of the sample in the format. See
Membrane.AudioMixer.ClipPreventingAdder
. - If false, overflow will be clipped to the maximal value of the sample in
the format. See
Membrane.AudioMixer.Adder
.
- If true, the wave will be scaled down, so a peak will become the maximal
value of the sample in the format. See
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. SeeMembrane.AudioMixer.NativeAdder
.
pads
Pads
input
:input
Availability | :on_request |
Caps | Membrane.RawAudio , restrictions:sample_format: one_of([:s8, :s16le, :s16be, :s24le, :s24be, :s32le, :s32be]) ,Membrane.RemoteStream |
Demand mode | :manual |
Demand unit | :bytes |
Direction | :input |
Mode | :pull |
Name | :input |
Options:
offset
Time.t()
Default value:
0
Offset of the input audio at the pad.
output
:output
Availability | :always |
Caps | Membrane.RawAudio |
Demand mode | :manual |
Demand unit | :buffers |
Direction | :output |
Mode | :pull |
Name | :output |
Link to this section Summary
Functions
Returns pads descriptions for Membrane.AudioMixer
Returns description of options available for this module
Link to this section Types
@type input_pad_opts_t() :: [{:offset, Membrane.Time.t()}]
Options for pad :input
@type t() :: %Membrane.AudioMixer{ caps: Membrane.RawAudio.t(), frames_per_buffer: pos_integer(), native_mixer: boolean(), prevent_clipping: boolean() }
Struct containing options for Membrane.AudioMixer
Link to this section Functions
@spec membrane_pads() :: [{Membrane.Pad.name_t(), Membrane.Pad.description_t()}]
Returns pads descriptions for Membrane.AudioMixer
@spec options() :: keyword()
Returns description of options available for this module