# `Octoroom.Audio`
[🔗](https://github.com/samrat/octoroom/blob/v0.1.0/lib/octoroom/audio.ex#L1)

Conversions between room PCM (48 kHz stereo s16le, Opus's own format, 20 ms
frames) and the format a worker asks for. Rates must divide 48 kHz
(8, 12, 16, 24 or 48 kHz) and channels must be 1 or 2.

# `frame_bytes`

# `from_room`

Room PCM to `rate`/`channels`. Each run of `48_000 / rate` frames is
averaged into one, which also low-passes before decimating. Returns
`{pcm, rest}`, where `rest` belongs in front of the next call's input.

# `rechannel`

Converts s16le PCM between 1 and 2 channels (mono is copied to both; stereo is averaged).

# `room_rate`

# `to_room`

PCM at `rate`/`channels` to room PCM, by linear interpolation. `prev` is
the last frame of the previous call as `{left, right}` (`{0, 0}` to start);
returns `{pcm, last_frame}`. A trailing partial frame is dropped.

# `validate!`

Raises unless `rate` and `channels` can be converted.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
