iulaw#

class diffsptk.MuLawExpansion(abs_max=1, mu=255)[source]#

See this page for details.

Parameters:
abs_maxfloat > 0

Absolute maximum value of input.

muint >= 1

Compression factor, \(\mu\).

forward(y)[source]#

Expand waveform by \(\mu\)-law algorithm.

Parameters:
yTensor [shape=(…,)]

Compressed waveform.

Returns:
outTensor [shape=(…,)]

Waveform.

Examples

>>> x = diffsptk.ramp(4)
>>> ulaw = diffsptk.MuLawCompression(4)
>>> iulaw = diffsptk.MuLawExpansion(4)
>>> x2 = iulaw(ulaw(x))
>>> x2
tensor([0.0000, 1.0000, 2.0000, 3.0000, 4.0000])
diffsptk.functional.iulaw(y, abs_max=1, mu=255)[source]#

Expand waveform by \(\mu\)-law algorithm.

Parameters:
yTensor [shape=(…,)]

Compressed waveform.

abs_maxfloat > 0

Absolute maximum value of input.

muint >= 1

Compression factor, \(\mu\).

Returns:
outTensor [shape=(…,)]

Waveform.

See also

ulaw