webrtc_codecs_g711 (webrtc_codecs v0.1.0)

View Source

G.711 codec plugin: PCMU (mu-law) and PCMA (A-law), 8 kHz mono, in pure Erlang.

webrtc:add_transceiver(Pc, audio, #{frames => true, codec_plugin => {webrtc_codecs_g711, #{}}}).

decode/2 gives one webrtc_codecs:audio/0 per frame, at 8000 Hz, one channel. encode/2 takes the same at 8000 Hz, one channel, and gives one frame per ptime of samples.

Options: ptime, the frame duration in milliseconds (default 20).

Summary

Functions

Compress signed 16 bit little endian samples to one G.711 byte each.

Expand G.711 bytes to signed 16 bit little endian samples.

Functions

compress/2

-spec compress(ulaw | alaw, binary()) -> binary().

Compress signed 16 bit little endian samples to one G.711 byte each.

expand/2

-spec expand(ulaw | alaw, binary()) -> binary().

Expand G.711 bytes to signed 16 bit little endian samples.