iulaw#

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

See this page for details.

Parameters:
abs_maxfloat > 0

The absolute maximum value of the original input waveform.

muint >= 1

The compression factor, \(\mu\).

forward(y: Tensor) Tensor[source]#

Expand the waveform using the \(\mu\)-law algorithm.

Parameters:
yTensor [shape=(…,)]

The input compressed waveform.

Returns:
outTensor [shape=(…,)]

The expanded 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: Tensor, abs_max: float = 1, mu: int = 255) Tensor[source]#

Expand the waveform using the \(\mu\)-law algorithm.

Parameters:
yTensor [shape=(…,)]

The compressed waveform.

abs_maxfloat > 0

The absolute maximum value of the original input waveform.

muint >= 1

The compression factor, \(\mu\).

Returns:
outTensor [shape=(…,)]

The expanded waveform.

See also

ulaw