ulaw#
- class diffsptk.MuLawCompression(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(x)[source]#
Compress waveform by \(\mu\)-law algorithm.
- Parameters:
- xTensor [shape=(…,)]
Waveform.
- Returns:
- outTensor [shape=(…,)]
Compressed waveform.
Examples
>>> x = diffsptk.ramp(4) >>> ulaw = diffsptk.MuLawCompression(4) >>> y = ulaw(x) >>> y tensor([0.0000, 3.0084, 3.5028, 3.7934, 4.0000])
- diffsptk.functional.ulaw(x, abs_max=1, mu=255)[source]#
Compress waveform by \(\mu\)-law algorithm.
- Parameters:
- xTensor [shape=(…,)]
Waveform.
- abs_maxfloat > 0
Absolute maximum value of input.
- muint >= 1
Compression factor, \(\mu\).
- Returns:
- outTensor [shape=(…,)]
Compressed waveform.
See also