Μ-law algorithm

Μ-law algorithm

The µ-law algorithm (pronounced myoo-law) is a companding algorithm, primarily used in the digital telecommunication systems of North America and Japan. As with other companding algorithms, its purpose is to reduce the dynamic range of an audio signal. In the analog domain, this can increase the signal-to-noise ratio (SNR) achieved during transmission, and in the digital domain, it can reduce the quantization error (hence increasing signal to quantization noise ratio). These SNR increases can be traded instead for reduced bandwidth for equivalent SNR.

It is similar to the A-law algorithm used in Europe.

Algorithm Types

There are two forms of this algorithm - an analog version, and a quantized digital version.


For a given input "x", the equation for μ-law encoding is [cite web |url=http://www.cisco.com/en/US/tech/tk1077/technologies_tech_note09186a00801149b3.shtml |title=Cisco - Waveform Coding Techniques |accessdate=2008-07-29 ]

:F(x) = sgn(x) frac{ln(1+ mu |x|)}{ln(1+mu)}~~~~-1 leq x leq 1,

where "μ" = 255 (8 bits) in the North American and Japanese standards.

μ-law expansion is then given by the inverse equation:

:F^{-1}(y) = sgn(y) (1 / mu ) [(1 + mu)^- 1] ~~~~-1 leq y leq 1

The equations are culled from [http://www.cisco.com/en/US/tech/tk1077/technologies_tech_note09186a00801149b3.shtml Cisco's Waveform Coding Techniques] .


This is defined in ITU-T Recommendation G.711 [cite web |url=http://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-G.711-198811-I!!PDF-E&type=items |title=ITU-T Recommendation G.711]

G.711 is unclear about what the values at the limit of a range code up as. (e.g. whether +31 codes to 0xEF or 0xF0).However G.191 provides example C code for a μ-law encoder which gives the following encoding. Note the difference between the positive and negative ranges. e.g. the negative range corresponding to +30 to +1 is -31 to -2. This is accounted for by the use of a 1's complement (simple bit inversion) rather than 2's complement to convert a negative value to a positive value during encoding.


There are three ways of implementing a μ-law algorithm :;Analog: Use an amplifier with non-linear gain to achieve companding entirely in the analog domain.;Non-linear ADC: Use an Analog to Digital Converter with quantization levels which are unequally spaced to match the μ-law algorithm.;Digital: Use the quantized digital version of the μ-law algorithm to convert data once it is in the digital domain.

Usage Justification

This encoding is used because speech has a wide dynamic range. In the analog world, when mixed with a relatively constant background noise source, the finer detail is lost. Given that the precision of the detail is compromised anyway, and assuming that the signal is to be perceived as audio by a human, one can take advantage of the fact that perceived intensity (loudness) is logarithmic [cite web |url=http://en.wikipedia.org/wiki/Sound |title=Wikipedia on sound] by compressing the signal using a logarithmic-response op-amp. In telco circuits, most of the noise is injected on the lines, thus after the compressor, the intended signal will be perceived as significantly louder than the static, compared to an un-compressed source. This became a common telco solution, and thus, prior to common digital usage, the μ-law specification was developed to define an inter-compatible standard.

As the digital age dawned, it was noted that this pre-existing algorithm had the effect of significantly reducing the number of bits needed to encode recognizable human voice. Using μ-law, a sample could be effectively encoded in as few as 8 bits, a sample size that conveniently matched the symbol size of most standard computers.

μ-law encoding effectively reduced the dynamic range of the signal, thereby increasing the coding efficiency while biasing the signal in a way that results in a signal-to-distortion ratio that is greater than that obtained by linear encoding for a given number of bits. This is an early form of perceptual audio encoding.

The μ-law algorithm is also used in the .au format, which dates back at least to the SPARCstation 1 as the native method used by Sun's /dev/audio interface, widely used as a de facto standard for Unix sound. The .au format is also used in various common audio API's such as the classes in the sun.audio Java package in Java 1.1 and in some C# methods.

This plot illustrates how μ-law concentrates sampling in the smaller (softer) values. The values of a μ-law byte 0-255 are the horizontal axis, the vertical axis is the 16 bit linear decoded value. This image was generated with the Sun Microsystems c routine g711.c commonly available on the Internet.

Comparison with A-law

The µ-law algorithm provides a slightly larger dynamic range than the A-law at the cost of worse proportional distortion for small signals. By convention, A-law is used for an international connection if at least one country uses it.

See also

* ITU-T Recommendation G.711
* Au file format
* A-law algorithm
* Audio level compression
* Signal compression
* Companding


External links

* [http://www.cisco.com/warp/public/788/signalling/waveform_coding.html Waveform Coding Techniques] - Has details of implementation
* [http://focus.ti.com/lit/an/spra163a/spra163a.pdf A-Law and mu-Law Companding Implementations Using the TMS320C54x] (PDF)
* [http://focus.ti.com/lit/an/spra634/spra634.pdf TMS320C6000 μ-Law and A-Law Companding with Software or the McBSP] (PDF)
* [http://hazelware.luggle.com/tutorials/mulawcompression.html A-law and μ-law realisation (on C)]

Wikimedia Foundation. 2010.

Look at other dictionaries:

  • μ-law algorithm — Companding of μ law and A law algorithms The µ law algorithm (often u law, ulaw, or mu law) is a companding algorithm, primarily used in the digital telecommunication systems of North America and Japan. Companding algorithms reduce the dynamic… …   Wikipedia

  • A-law algorithm — Graph of μ law A law algorithms An A law algorithm is a standard companding algorithm, used in European digital communications systems to optimize, i.e., modify, the dynamic range of an analog signal for digitizing. It is similar to the μ law… …   Wikipedia

  • Law of excluded middle — This article uses forms of logical notation. For a concise description of the symbols used in this notation, see Table of logic symbols. In logic, the law of the excluded middle states that the propositional calculus formula P ∨ ¬ P ( P or not P… …   Wikipedia

  • Amdahl's law — Amdahl s law, also known as Amdahl s argument, [Rodgers 85, p.226] is named after computer architect Gene Amdahl, and is used to find the maximum expected improvement to an overall system when only part of the system is improved. It is often used …   Wikipedia

  • Constraint algorithm — In mechanics, a constraint algorithm is a method for satisfying constraints for bodies that obey Newton s equations of motion. There are three basic approaches to satisfying such constraints: choosing novel unconstrained coordinates ( internal… …   Wikipedia

  • Software patents under United States patent law — Software or computer programs are not explicitly mentioned in United States patent law. In the face of new technologies, decisions of the United States Supreme Court and United States Court of Appeals for the Federal Circuit (CAFC) have sought to …   Wikipedia

  • International Data Encryption Algorithm — IDEA An encryption round of IDEA General Designers Xuejia Lai and James Massey …   Wikipedia

  • Expectation-maximization algorithm — An expectation maximization (EM) algorithm is used in statistics for finding maximum likelihood estimates of parameters in probabilistic models, where the model depends on unobserved latent variables. EM alternates between performing an… …   Wikipedia

  • List of United States patent law cases — This is a list of patent law cases in the United States from 1878 to 2007.Early cases*City of Elizabeth v. American Nicholson Pavement Co. 1878. Prior use does not include experimental use. *Egbert v. Lippmann 1881. Held that public use of an… …   Wikipedia

  • Brooks's law — is a principle in software development which says that adding manpower to a late software project makes it later .Frederick P. Brooks, Jr. The Mythical Man Month . 1995. Addison Wesley.] It was coined by Fred Brooks in his 1975 book The Mythical… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.