View Source Membrane.RawAudio (Membrane: raw audio format v0.12.0)
This module contains a definition and related functions for struct Membrane.RawAudio.t/0
,
describing a format of raw audio stream with interleaved channels.
Summary
Functions
Determines if the sample values are represented by a number in big endian byte ordering.
Converts bytes to frames in given format.
Converts bytes to time in Membrane.Time units in given format.
Returns how many bytes are needed to store a single frame.
Converts frames to bytes in given format.
Converts frames to time in Membrane.Time units in given format.
Determines if the sample values are represented by a number in little endian byte ordering.
Returns maximum sample value for given sample format.
Returns minimum sample value for given sample format.
Returns how many bytes are needed to store a single sample.
Converts one raw sample into its numeric value, interpreting it for given sample format.
Determines if the sample values are represented by an integer.
Determines if the sample values are represented by a floating point number.
Determines if the sample values are represented by a signed number.
Returns one 'silent' sample, that is value of zero in given format' sample format.
Returns a binary which corresponds to the silence during the given interval of time in given format' sample format
Converts time in Membrane.Time units to bytes in given format.
Converts time in Membrane.Time units to frames in given format.
Determines if the sample values are represented by an unsigned number.
Converts value into one raw sample, encoding it with the given sample format.
Same as value_to_sample/2, but also checks for overflow. Returns {:error, :overflow} if overflow happens.
Types
@type channels_t() :: pos_integer()
@type sample_rate_t() :: pos_integer()
@type t() :: %Membrane.RawAudio{ channels: channels_t(), sample_format: Membrane.RawAudio.SampleFormat.t(), sample_rate: sample_rate_t() }
Functions
Determines if the sample values are represented by a number in big endian byte ordering.
Inlined by the compiler.
@spec bytes_to_frames(non_neg_integer(), t(), (float() -> integer())) :: non_neg_integer()
Converts bytes to frames in given format.
Inlined by the compiler.
@spec bytes_to_time(non_neg_integer(), t(), (float() -> integer())) :: Membrane.Time.non_neg()
Converts bytes to time in Membrane.Time units in given format.
Inlined by the compiler.
Returns how many bytes are needed to store a single frame.
Inlined by the compiler
@spec frames_to_bytes(non_neg_integer(), t()) :: non_neg_integer()
Converts frames to bytes in given format.
Inlined by the compiler.
@spec frames_to_time(non_neg_integer(), t(), (float() -> integer())) :: Membrane.Time.non_neg()
Converts frames to time in Membrane.Time units in given format.
Inlined by the compiler.
Determines if the sample values are represented by a number in little endian byte ordering.
Inlined by the compiler.
Returns maximum sample value for given sample format.
Inlined by the compiler.
Returns minimum sample value for given sample format.
Inlined by the compiler.
Returns how many bytes are needed to store a single sample.
Inlined by the compiler
Converts one raw sample into its numeric value, interpreting it for given sample format.
Inlined by the compiler.
Determines if the sample values are represented by an integer.
Inlined by the compiler.
Determines if the sample values are represented by a floating point number.
Inlined by the compiler.
Determines if the sample values are represented by a signed number.
Inlined by the compiler.
Returns one 'silent' sample, that is value of zero in given format' sample format.
Inlined by the compiler.
@spec silence(t(), Membrane.Time.non_neg(), (float() -> integer())) :: binary()
Returns a binary which corresponds to the silence during the given interval of time in given format' sample format
Examples:
The following code generates the silence for the given format
iex> alias Membrane.RawAudio
iex> format = %RawAudio{sample_rate: 48_000, sample_format: :s16le, channels: 2}
iex> silence = RawAudio.silence(format, 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, format, round_f \\ &(&1 |> :math.ceil() |> trunc))
View Source@spec time_to_bytes(Membrane.Time.non_neg(), t(), (float() -> integer())) :: non_neg_integer()
Converts time in Membrane.Time units to bytes in given format.
Inlined by the compiler.
time_to_frames(time, format, round_f \\ &(&1 |> :math.ceil() |> trunc))
View Source@spec time_to_frames(Membrane.Time.non_neg(), t(), (float() -> integer())) :: non_neg_integer()
Converts time in Membrane.Time units to frames in given format.
Inlined by the compiler.
Determines if the sample values are represented by an unsigned number.
Inlined by the compiler.
Converts value into one raw sample, encoding it with the given sample format.
Inlined by the compiler.
Same as value_to_sample/2, but also checks for overflow. Returns {:error, :overflow} if overflow happens.
Inlined by the compiler.