AI Glossary / MLOps and deployment / Intermediate

A-law algorithm

Definition

A-law is a companding law used to represent audio samples with nonuniform quantization, notably in the G.711 telephony standard. It allocates finer amplitude steps to weaker signals and coarser steps to stronger ones. In standard G.711 A-law coding, each sample is represented by eight bits, commonly at 8,000 samples per second.

What it means

Companding combines compression and expansion of the amplitude representation. The encoder maps a wider linear-amplitude range into a compact code, and the decoder maps that code back to a representative amplitude.

This is different from lossless file compression. Several possible input amplitudes can map to the same quantized code, so decoding does not recover every original amplitude exactly. It is also different from simply turning down the volume: the mapping is nonlinear and changes how resolution is distributed across signal levels.

In internet audio descriptions, PCMA denotes G.711 A-law, while PCMU denotes the related mu-law format. Both use eight-bit samples, but their code-to-amplitude mappings differ. Misinterpreting one as the other can produce incorrect audio even if the byte count looks right.

How it works

An analog or linear digital audio signal is sampled and encoded using the prescribed quantization characteristic. Small amplitudes receive more closely spaced reconstruction levels relative to a uniform eight-bit amplitude grid, while larger amplitudes use wider spacing.

A compatible decoder expands each code into the corresponding linear-amplitude value. The exact digital mapping and bit conventions are defined by the standard; a broad description as 'logarithmic compression' is not enough to implement interoperable code.

The basic sample coding does not predict future samples or build a dictionary of repeated sounds. Sample rate, channel count, packetization and signaling remain separate parameters in a working audio system. Network delay, lost packets and microphone quality can affect a call independently of the companding law.

Three practical examples

  • A voice-service integration verifies that an incoming stream labeled PCMA is decoded using A-law before further processing.
  • An audio-data pipeline converts a correctly identified telephone recording to linear samples for a speech-recognition experiment.
  • A communications engineer calculates G.711 payload bandwidth separately from packet and transport overhead.

Think of it this way

Think of a measuring ruler whose divisions are close together near zero and farther apart for larger values. It uses a limited number of marks to preserve relatively fine resolution for small measurements.

The analogy is limited because A-law defines signed audio reconstruction levels and exact binary codes. Expanding a recorded value cannot recover distinctions that fell between the same quantization marks, and the ruler itself does not explain sampling rate or packet delivery.

Worked example

Calculating the audio payload

For a mono G.711 A-law stream sampled at 8,000 samples per second with eight bits per sample, the payload rate is 8,000 × 8 = 64,000 bits per second, or 64 kbit/s using decimal units.

A packet containing 20 milliseconds of audio carries 8,000 × 0.020 = 160 samples. At one byte per sample, that is 160 payload bytes. There are 50 such packets per second, giving 160 × 50 = 8,000 payload bytes per second.

Suppose, purely for a transport calculation, each packet adds 40 bytes of combined headers. The total considered size becomes 200 bytes per packet, or 200 × 50 × 8 = 80,000 bits per second. This excludes any additional link-layer, security or other overhead.

The 64 kbit/s codec payload and the 80 kbit/s illustrative transported rate answer different questions. Neither establishes the audio's perceptual quality, packet-loss tolerance or transcription accuracy.

Changing the companding law to mu-law at the same sample rate and bit depth would not change this payload calculation, although it would change how the sample codes are interpreted.

Illustrative case study

Illustrative case study - fictional

A fictional customer-support platform imports telephone recordings for transcription. A newly connected source produces distorted playback, even though duration and file size appear plausible.

The team discovers that the incoming bytes are A-law samples but the conversion step interprets them as unsigned linear eight-bit audio. It corrects the format interpretation and checks representative recordings against the source playback. It also verifies the sample rate so that the audio is not played too quickly or too slowly.

Only after those checks does it evaluate transcription. The case illustrates how format mistakes can masquerade as model problems; it reports no measured recognition improvement.

Common misconceptions and mistakes

  • A-law coding is not lossless recovery of the original linear-amplitude signal.
  • Eight-bit A-law is not interchangeable with ordinary eight-bit linear PCM.
  • PCMA and PCMU have different mappings even when their payload rates match.
  • The codec payload rate does not include all network overhead.
  • Converting telephone audio to a higher sample rate does not recreate frequencies absent from the original recording.

Business use

A-law matters in systems that connect telephony with recording, analytics or AI speech processing. Correct identification and decoding are prerequisites for useful downstream analysis.

Record codec, sample rate, channel count and container or transport details. Use established standard-conforming conversion implementations and verify known samples. Calculate network capacity with the actual packetization and overhead, and evaluate recognition on representative call conditions. Avoid attributing poor audio solely to the speech model before checking decoding, clipping, noise and packet-related degradation.

People also ask

Is A-law the same as G.711?

A-law is one of the two companding laws defined in G.711; the other is mu-law.

Does A-law use fewer bits during quiet speech?

The basic G.711 A-law representation still uses eight bits per sample. Separate mechanisms can change transmission behavior during silence.

Can it be converted to linear PCM?

Yes. Each code maps to a defined reconstruction amplitude, but that conversion does not restore information lost through the original quantization.

Check your understanding

A 20-millisecond mono A-law payload contains 160 bytes at the standard 8 kHz rate. Does that mean the whole network packet is 160 bytes?

Answer: No. Headers and any other transport overhead add to the codec payload.

Related terms

  • Companding
  • Mu-law
  • Audio codec
  • G.711
  • pulse-code modulation
  • quantisation

Learn next

Compare linear and nonuniform quantization on a small amplitude range, noting which input distinctions are merged. Then calculate payload and total packet bandwidth separately for a specified audio packet duration.

More in MLOps and deployment

  • 842 (compression algorithm) - 842, also written 8-4-2, is a lossless data-compression scheme that represents data using small templates containing literal bytes and references to...
  • Action monitoring - Action monitoring is the practice of checking whether the conditions required for the next planned action still hold before attempting it, and detecting...
  • Adaptive compression - Adaptive compression is compression that changes its model or coding decisions in response to the data being processed.
  • Adaptive differential pulse-code modulation - Adaptive differential pulse-code modulation (ADPCM) is a family of audio-coding methods that represents the difference between a sample and its predicted...
  • Adaptive Huffman coding - Adaptive Huffman coding is lossless compression that changes a Huffman code tree as symbols are processed.
  • Algebraic code-excited linear prediction - Algebraic code-excited linear prediction (ACELP) is a speech-coding approach that represents speech using a prediction filter and a compact, mathematically...

Sources

Sources: ITU-T G.711, Pulse code modulation of voice frequencies: https://www.itu.int/rec/T-REC-G.711-198811-I/en ; RFC 3551, PCMA and PCMU: https://www.rfc-editor.org/rfc/rfc3551 . Relevant G.711 sampling and encoding-law text and RFC audio-format definitions were reviewed. The packet-header example is illustrative and is not a complete network-capacity estimate.

Previous: A-D conversion Next: A-optimal design

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer