pub struct ALAW(/* private fields */);Expand description
A-law companded sample, as defined by ITU-T G.711. Stored as 1 byte. A single byte has no byte order, so there are no little endian and big endian variants.
A-law fits the dynamic range of a 13 bit linear value into 8 bits, using a piecewise linear approximation of a logarithmic curve. The closest numeric type is i16, and the decoded values are scaled to that range. The largest representable magnitude is 32256, so the range does not quite reach the limits of an i16. A-law has no code for exact silence, the two smallest magnitudes are +8 and -8.
Note that i16 is wider than the 256 values this format can represent,
so unlike the linear formats, from_number
quantizes and a number does not survive a roundtrip unchanged.
Quantizing an already quantized value changes nothing further.
Note that a byte value of zero is not silence. It decodes to -5504.
The A-law code for the smallest positive value is 0xD5.
This is the format used for telephony in Europe and most of the world.
It appears as WAVE_FORMAT_ALAW in wav files, as PCMA in RTP streams,
and as SND_PCM_FORMAT_A_LAW in ALSA.