Mx.Audio (mx v0.1.0)

Copy Markdown View Source

Reads WAV and AIFF recordings, in mono or stereo, at any sample rate, as one channel of samples from -1 to 1.

A recording with several channels is read as their average. It also writes mono WAV files of 32-bit floats. WAV may hold integers of 8 to 32 bits or floats of 32 or 64 bits; AIFF holds big-endian integers, and AIFF-C also little-endian integers and floats.

Summary

Functions

Reads a recording, and returns {:ok, %{rate: rate, samples: samples}} or {:error, "cannot read PATH"}.

Writes samples from -1 to 1 to a mono WAV file of 32-bit floats at a sample rate.

Functions

read(path)

Reads a recording, and returns {:ok, %{rate: rate, samples: samples}} or {:error, "cannot read PATH"}.

write(path, samples, rate)

Writes samples from -1 to 1 to a mono WAV file of 32-bit floats at a sample rate.