ialaw#

class diffsptk.ALawExpansion(abs_max=1, a=87.6)[source]#

See this page for details.

Parameters:
abs_maxfloat > 0 [scalar]

Absolute maximum value of input.

afloat >= 1 [scalar]

Compression factor, \(A\).

forward(y)[source]#

Expand waveform by A-law algorithm.

Parameters:
yTensor [shape=(…,)]

Compressed waveform.

Returns:
xTensor [shape=(…,)]

Waveform.

Examples

>>> x = diffsptk.ramp(4)
>>> alaw = diffsptk.ALawCompression(4)
>>> ialaw = diffsptk.ALawExpansion(4)
>>> x2 = ialaw(alaw(x))
>>> x2
tensor([0.0000, 1.0000, 2.0000, 3.0000, 4.0000])

See also

alaw iulaw