Function File: y = compand (x, mu, V, "mu/compressor")
Function File: y = compand (x, mu, V, "mu/expander")
Function File: y = compand (x, mu, V, "A/compressor")
Function File: y = compand (x, mu, V, "A/expander")

Compresses and expanding the dynamic range of a signal using a mu-law or or A-law algorithm.

The mu-law compressor/expander for reducing the dynamic range, is used if the fourth argument of compand starts with "mu/". Whereas the A-law compressor/expander is used if compand starts with "A/". The mu-law algorithm uses the formulation


        V log (1 + \mu/V |x|)
    y = -------------------- sgn(x)
            log (1 + \mu)

while the A-law algorithm used the formulation


        /    A / (1 + log A) x,               0 <= |x|<= V/A
        |
    y = <    V ( 1 + log (A/V |x|) )
        |   ----------------------- sgn(x),  V/A < |x|<= V
        \        1 + log A

Neither converts from or to audio file ulaw format. Use mu2lin or lin2mu instead.

See also: m2ulin, lin2mu.

Package: communications