iulaw#

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

See this page for details.

Parameters:
abs_maxfloat > 0 [scalar]

Absolute maximum value of input.

muint >= 1 [scalar]

Compression factor, \(\mu\).

forward(y)[source]#

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

Parameters:
yTensor [shape=(…,)]

Compressed waveform.

Returns:
xTensor [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])

See also

ulaw