Cauldron2D.GameMaker.Wave (Cauldron2D.GameMaker v0.2.1)

Copy Markdown View Source

A stored sound in WAVE form (a RIFF file of PCM samples), as games keep their short effects in the AUDO chunk.

{:ok, %{rate: 44_100, channels: 1, pcm: pcm}} = Cauldron2D.GameMaker.Wave.read(bytes)

pcm is signed 16-bit little-endian samples, channels interleaved, whatever the file stored: 8-bit samples are widened, 24- and 32-bit samples keep their top 16 bits. A file in the extensible format is read when its sub-format is PCM. Anything that is not uncompressed PCM is {:error, :not_pcm}; a file that is not WAVE is {:error, :not_wave}.

Summary

Functions

The rate, channel count and 16-bit PCM of the WAVE file in bytes.

Functions

read(arg1)

@spec read(binary()) ::
  {:ok, %{rate: pos_integer(), channels: pos_integer(), pcm: binary()}}
  | {:error, :not_wave | :not_pcm}

The rate, channel count and 16-bit PCM of the WAVE file in bytes.