wavex v0.1.0 Wavex.DataChunk

Reading a data chunk.

Link to this section Summary

Link to this section Types

Link to this type t()
t() :: %Wavex.DataChunk{data: binary(), size: non_neg_integer()}

Link to this section Functions

Link to this function read(binary, block_align)
read(binary(), non_neg_integer()) :: {:ok, t()} | {:error, binary()}

Read a data chunk.

Examples

sapp.org, 2018-04-30, Microsoft WAVE soundfile format

iex> Wavex.DataChunk.read(<<
...> # d     a     t     a
...>   0x64, 0x61, 0x74, 0x61,
...> # 2
...>   0x02, 0x00, 0x00, 0x00,
...> # 0
...>   0x00, 0x00, 0x00, 0x00,
...> # 0
...>   0x00, 0x00, 0x00, 0x00
...> >>, 4)
{:ok, %Wavex.DataChunk{size: 2, data: <<0, 0, 0, 0, 0, 0, 0, 0>>}}