Membrane.Caps.Audio.Raw (Membrane Caps: Audio.Raw v0.5.0) View Source
This module implements struct for caps representing raw audio stream with interleaved channels.
Link to this section Summary
Functions
Determines if format is big endian.
Converts bytes to frames in given caps.
Converts bytes to time in Membrane.Time units in given caps.
Returns how many bytes are needed to store a single frame.
Converts frames to bytes in given caps.
Converts frames to time in Membrane.Time units in given caps.
Determines if format is little endian.
Returns maximum sample value for given format.
Returns minimum sample value for given format.
Returns how many bytes are needed to store a single sample.
Converts one raw sample into its numeric value, interpreting it for given format.
Determines if format is floating point.
Determines if format is integer.
Determines if format is signed.
Returns one 'silent' sample, that is value of zero in given caps' format.
Returns a binary which corresponds to the silence during the given interval of time in given caps' fromat
Converts time in Membrane.Time units to bytes in given caps.
Converts time in Membrane.Time units to frames in given caps.
Determines if format is unsigned.
Converts value into one raw sample, encoding it in given format.
Same as value_to_sample/2, but also checks for overflow. Returns {:error, :overflow} if overflow happens.
Link to this section Types
Specs
channels_t() :: pos_integer()
Specs
sample_rate_t() :: pos_integer()
Specs
t() :: %Membrane.Caps.Audio.Raw{ channels: channels_t(), format: Membrane.Caps.Audio.Raw.Format.t(), sample_rate: sample_rate_t() }
Link to this section Functions
Specs
Determines if format is big endian.
Inlined by the compiler.
Converts bytes to frames in given caps.
Inlined by the compiler.
Specs
bytes_to_time(non_neg_integer(), t(), (float() -> integer())) :: Membrane.Time.non_neg_t()
Converts bytes to time in Membrane.Time units in given caps.
Inlined by the compiler.
Specs
Returns how many bytes are needed to store a single frame.
Inlined by the compiler
Specs
frames_to_bytes(non_neg_integer(), t()) :: non_neg_integer()
Converts frames to bytes in given caps.
Inlined by the compiler.
Specs
frames_to_time(non_neg_integer(), t(), (float() -> integer())) :: Membrane.Time.non_neg_t()
Converts frames to time in Membrane.Time units in given caps.
Inlined by the compiler.
Specs
Determines if format is little endian.
Inlined by the compiler.
Specs
Returns maximum sample value for given format.
Inlined by the compiler.
Specs
Returns minimum sample value for given format.
Inlined by the compiler.
Specs
Returns how many bytes are needed to store a single sample.
Inlined by the compiler
Specs
Converts one raw sample into its numeric value, interpreting it for given format.
Inlined by the compiler.
Specs
Determines if format is floating point.
Inlined by the compiler.
Specs
Determines if format is integer.
Inlined by the compiler.
Specs
Determines if format is signed.
Inlined by the compiler.
Specs
Returns one 'silent' sample, that is value of zero in given caps' format.
Inlined by the compiler.
sound_of_silence(caps, time, round_f \\ &(&1 |> :math.ceil() |> trunc))
View SourceSpecs
sound_of_silence(t(), Membrane.Time.non_neg_t(), (float() -> integer())) :: binary()
Returns a binary which corresponds to the silence during the given interval of time in given caps' fromat
Examples:
The following code generates the silence for the given caps
iex> alias Membrane.Caps.Audio.Raw, as: Caps
iex> caps = %Caps{sample_rate: 48_000, format: :s16le, channels: 2}
iex> silence = Caps.sound_of_silence(caps, 100 |> Membrane.Time.microseconds)
<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>
time_to_bytes(time, caps, round_f \\ &(&1 |> :math.ceil() |> trunc))
View SourceSpecs
time_to_bytes(Membrane.Time.non_neg_t(), t(), (float() -> integer())) :: non_neg_integer()
Converts time in Membrane.Time units to bytes in given caps.
Inlined by the compiler.
time_to_frames(time, caps, round_f \\ &(&1 |> :math.ceil() |> trunc))
View SourceSpecs
time_to_frames(Membrane.Time.non_neg_t(), t(), (float() -> integer())) :: non_neg_integer()
Converts time in Membrane.Time units to frames in given caps.
Inlined by the compiler.
Specs
Determines if format is unsigned.
Inlined by the compiler.
Specs
Converts value into one raw sample, encoding it in given format.
Inlined by the compiler.
Specs
Same as value_to_sample/2, but also checks for overflow. Returns {:error, :overflow} if overflow happens.
Inlined by the compiler.